MIDAS  0.75
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
substructs.h
Go to the documentation of this file.
1 #ifndef MIDAS_SUBSTRUCTS_H
2 #define MIDAS_SUBSTRUCTS_H
3 
4 #include "subject.h"
5 
6 
13 namespace midaspace {
14 
15 //* ********************************************************************************************
16 //* *** *** *** *** CLASS DOFatt *** *** *** ***
17 //* ********************************************************************************************
33 {
34  protected:
36  int ndofs;
38  int *att;
40  int *mask;
41 
42  public:
44  PointDOFsAttributes ( long gid, const GeometryComponent *owner) : GeomCompSubject (gid, owner) { ndofs = -1; att = mask = NULL; }
46  PointDOFsAttributes ( long gid, const Problem *owner) : GeomCompSubject (gid, owner) { ndofs = -1; att = mask = NULL; }
48  PointDOFsAttributes (const PointDOFsAttributes *src, const GeometryComponent *owner) : GeomCompSubject (src->give_ID(), owner ? owner : src->give_GC()) {
49  ndofs = src->ndofs;
50  if (src->att) { att = new int[ndofs]; memcpy (att, src->att, ndofs*sizeof(int)); } else att = NULL;
51  if (src->mask) { mask = new int[ndofs]; memcpy (mask, src->mask, ndofs*sizeof(int)); } else mask = NULL;
52  }
54  virtual ~PointDOFsAttributes() { delete [] att; delete [] mask; }
55 
56 
58  virtual void checkConsistency (void) const {
60  if (ndofs<1 || att == NULL) errol;
61  if (mask == NULL)
62  if (ndofs != Pd->give_global_nDOFs()) _errorr ("Mishmash in nDOFs");
63  }
64 
65  // *** SET ***
66  void set_ndofs (int n ) { ndofs = n; }
67  void set_att (int i, int val) { if ( att == NULL) errol; att[i] = val; }
68  void set_ndofsatt (int n, int *val) { if (ndofs != -1 || att != NULL) errol; ndofs = n; att = new int[ndofs]; memcpy (att, val, ndofs*sizeof(int)); }
69  void set_ndofsatt (int n, long *val) { if (ndofs != -1 || att != NULL) errol; ndofs = n; att = new int[ndofs]; while (n--) att[n] = val[n]; }
70 
71  // *** GET ***
72  int give_ndofs (void) const { return ndofs; }
73  int give_att (int i) const { return att[i]; }
74  int give_mask (int i) const { return mask[i]; }
75  const int* give_att (void) const { return att; }
76  const int* give_mask (void) const { return mask; }
77 
78  // IS
79  bool mask_is_null (void) const { return (mask == NULL) ? true : false; }
80  bool is_identical_with (const PointDOFsAttributes *src) const {
81  if ( ndofs != src->ndofs ) return false;
82  if (arrays_arenot_identical(ndofs, att, src->att )) return false;
83  if (arrays_arenot_identical(ndofs, mask, src->mask ) && (mask || src->mask)) return false;
84  return true;
85  }
86 
87 
89  // ndofs is -1, att == NULL, mask == NULL
90  void scan_ndofs_new (const char *&str) { SP_scan_number (str, ndofs); }
91  void scan_att_ndofs_new (const char *&str) { SP_scan_number (str, ndofs); this->scan_att(str); }
92  void scan_mask_ndofs_new (const char *&str) { SP_scan_number (str, ndofs); this->scan_mask(str); }
93  // ndofs is initiated, att == NULL, mask == NULL
94  void scan_ndofs_expected (const char *&str) { SP_scan_expected_number_exit (str, ndofs, "nDOFs mismatch"); }
95  void scan_att_ndofs_expected (const char *&str) { SP_scan_expected_number_exit (str, ndofs, "nDOFs mismatch"); this->scan_att(str); }
96  void scan_mask_ndofs_expected (const char *&str) { SP_scan_expected_number_exit (str, ndofs, "nDOFs mismatch"); this->scan_mask(str); }
97 
98  // ndofs is initiated, att == NULL, mask == NULL
99  void rescan_att (const char *&str) { if (att == NULL) _errorr ("att == NULL"); SP_scan_array (str, ndofs, att); }
100  void scan_att (const char *&str) { if (att != NULL) _errorr ("att != NULL"); att = new int[ndofs]; SP_scan_array (str, ndofs, att); }
101  void scan_mask (const char *&str) { if (mask != NULL) _errorr ("mask != NULL"); mask = new int[ndofs]; SP_scan_array (str, ndofs, mask); }
102  void scan_att_new_sparse(const char *&str) { if (mask != NULL) _errorr ("mask != NULL"); att = new int[ndofs]; memset(att, 0, ndofs*sizeof(int));
103  int n, val;
104  SP_scan_number (str, n);
105  for (int i=0; i<n; i++) {
106  SP_scan_number (str, val);
107  if (val>ndofs) errol;
108  att[val-1] = 1;
109  }
110  }
111  // ndofs == -1
112  // nascanuji ndofs a pak pole att
113  // void scan_ndofsatt (const char *&str) {
114 
115 
116 
117 };
118 
119 
120 //* ********************************************************************************************
121 //* *** *** *** *** CLASS DOFatt_cond *** *** *** ***
122 //* ********************************************************************************************
132 {
133  public:
135  PointDOFsBCPM ( long gid, const GeometryComponent *owner) : PointDOFsAttributes (gid, owner) { if (!owner) errol; }
137  PointDOFsBCPM ( long gid, const Problem *owner) : PointDOFsAttributes (gid, owner) { if (!owner) errol; }
139  PointDOFsBCPM (const PointDOFsBCPM *src, const GeometryComponent *owner) : PointDOFsAttributes (src, owner) { if (!owner) errol; }
141  virtual ~PointDOFsBCPM() { }
142 
144  bool rer (void) const
145  {
146  if (ndofs != 6) errol;
147  if (att==NULL) errol;
148 
149  return (att[0] == 0 && att[1] == 0 && att[2] == 0 && att[3] == 0 && att[4] == 0 && att[5] == 1);
150  }
151 
153  bool is_supported (void) const
154  {
155  if (att==NULL) return false;
156  register int i = ndofs, sum = 0;
157  while (i--) sum += att[i];
158  return sum;
159  }
160 
163  {
164  if (att==NULL) errol; // docasne, pokud to bude NULL tak by bylo cele pole -1
165  aa->resize_ignore_vals(6);
166  aa->fillYourselfBy (-1);
167  if (mask==NULL) {
168  ((PointDOFsBCPM*)this)->mask = DOFsPerNode2dofBCmask (Pd->give_DOFspnod());
169  }
170  for (int i=0; i<ndofs; i++) (*aa)[(int)mask[i]-1] = att[i];
171  }
172 
174  // i
175  // 1 -> 0 -> 0
176  // 0 -> -1 -> 1
177  // -1 -> -2 -> 2
178  // -2 -> -3 -> 3
180  {
181  for (int i=0; i<ndofs; i++) att[i] = 1 - att[i];
182  }
183  int BC_give_att_SIFEL_NODEBC_reverted (int i) const { return 1 - att[i]; }
184 
186  {
188  if (ndofs == -1 && att==NULL) {
190  att = new int[ndofs];
191  memset(att, 0, ndofs*sizeof(int));
192  }
193  else if (att == NULL) errol;
194 
196  if (mask) errol;
197  if (Pd->give_DOFspnod() == DPN_DxyzRxyz) att[3] = att[4] = att[5] = 1;
198  else errol;
199  }
200 
202  att = new int[ndofs];
203  for (int i=0; i<ndofs; i++)
204  att[i] = 0;
205  }
206 
207 
210  ndofs = 12;
211  att = new int[ndofs]; memset(att, 0, ndofs*sizeof(int));
212  mask = new int[ndofs];
213 
214  mask[0] = mask[ 6] = 1;
215  mask[1] = mask[ 7] = 2;
216  mask[2] = mask[ 8] = 3;
217  mask[3] = mask[ 9] = 4;
218  mask[4] = mask[10] = 5;
219  mask[5] = mask[11] = 6;
220  }
221 };
222 
223 //* ********************************************************************************************
224 //* *** *** *** *** CLASS DOFatt_cond *** *** *** ***
225 //* ********************************************************************************************
233 {
234  public:
236  PointDOFsRANHN (long gid, const GeometryComponent *owner) : PointDOFsAttributes (gid, owner) {}
238  PointDOFsRANHN (long gid, const Problem *owner) : PointDOFsAttributes (gid, owner) {}
240  virtual ~PointDOFsRANHN() { }
241 
244  if (ndofs < 1 || att != NULL || mask != NULL) errol;
245  att = new int[ndofs];
246  mask = new int[ndofs];
247  fill_all_by (att, ndofs, 2);
248  fill_all_by (mask, ndofs, 1);
249  }
250 
253  if (!mask && !att) {
254  att = new int[ndofs];
255  mask = new int[ndofs];
256  for (int i=0; i<ndofs; i++) {
257  att[i] = 2;
258  mask[i] = 1;
259  }
260  }
261 
262  if (mask && !att) {
263  att = new int[ndofs];
264  for (int i=0; i<ndofs; i++)
265  att[i] = mask[i] ? 2 : 0;
266  }
267 
268  if (att && !mask) {
269  mask = new int[ndofs];
270  for (int i=0; i<ndofs; i++)
271  mask[i] = att[i] ? 1 : 0;
272  }
273  }
274 };
275 
276 
277 //* ********************************************************************************************
278 //* *** *** *** *** CLASS DOFatt_cond *** *** *** ***
279 //* ********************************************************************************************
288 {
289  public:
291  PointDOFsCondense (long gid, const Element *owner);
293  PointDOFsCondense (const PointDOFsCondense *src, const GeometryComponent *owner) : PointDOFsAttributes (src, owner) { if (!owner) errol; }
295  virtual ~PointDOFsCondense() { }
296 
298  virtual void checkConsistency (void) const { PointDOFsAttributes :: checkConsistency(); if (ndofs<1 || att == NULL || mask) errol; }
299 
301  void set_full_hinge (bool noXrot);
303  bool is_full_hinge (void) const;
304 };
305 
306 } // namespace midaspace
307 
308 #endif // MIDAS_SUBSTRUCTS_H
virtual ~PointDOFsAttributes()
DESTRUCTOR.
Definition: substructs.h:54
PointDOFsBCPM(long gid, const GeometryComponent *owner)
CONSTRUCTOR.
Definition: substructs.h:135
PointDOFsRANHN(long gid, const Problem *owner)
CONSTRUCTOR.
Definition: substructs.h:238
int BC_give_att_SIFEL_NODEBC_reverted(int i) const
Definition: substructs.h:183
void set_ndofsatt(int n, int *val)
Definition: substructs.h:68
virtual ~PointDOFsRANHN()
DESTRUCTOR.
Definition: substructs.h:240
void set_full_hinge(bool noXrot)
Sets all rotation DOFs to be condensed.
Definition: substructs.cpp:21
const int * give_att(void) const
Definition: substructs.h:75
int give_ndofs(void) const
Definition: substructs.h:72
virtual void checkConsistency(void) const
Checks data consistency.
Definition: subject.h:41
bool is_full_hinge(void) const
Returns true if all rotation DOFs are condensed.
Definition: substructs.cpp:35
long arrays_arenot_identical(long n, ArgType *a1, ArgType *a2)
Definition: gelib.h:300
bool is_supported(void) const
Definition: substructs.h:153
#define SP_scan_expected_number_exit(_1, _2, _3)
Definition: librw.h:229
PointDOFsAttributes(long gid, const Problem *owner)
CONSTRUCTOR.
Definition: substructs.h:46
void RAN_set_full_slave_node(void)
Definition: substructs.h:243
void scan_att_ndofs_new(const char *&str)
Definition: substructs.h:91
void rescan_att(const char *&str)
Definition: substructs.h:99
PointDOFsBCPM(long gid, const Problem *owner)
CONSTRUCTOR.
Definition: substructs.h:137
PointDOFsCondense(const PointDOFsCondense *src, const GeometryComponent *owner)
CONSTRUCTOR COPY.
Definition: substructs.h:293
long give_ID() const
Definition: subject.h:45
virtual void checkConsistency(void) const
Checks data consistency.
Definition: substructs.h:298
#define errol
Definition: gelib.h:142
Derived class for management of RAN (rigid arm node) or HN (hanging node) connection of DOFs (Degrees...
Definition: substructs.h:232
void scan_mask_ndofs_new(const char *&str)
Definition: substructs.h:92
void scan_ndofs_new(const char *&str)
*** SCAN ***
Definition: substructs.h:90
const int * give_mask(void) const
Definition: substructs.h:76
bool is_identical_with(const PointDOFsAttributes *src) const
Definition: substructs.h:80
void set_standard_att_according_to_ndofs(void)
Definition: substructs.h:201
PointDOFsAttributes(const PointDOFsAttributes *src, const GeometryComponent *owner)
CONSTRUCTOR COPY.
Definition: substructs.h:48
bool rer(void) const
Definition: substructs.h:144
int * DOFsPerNode2dofBCmask(DOFsPerNode od)
Definition: alias.h:787
int * mask
Mask array is "ndofs" long.
Definition: substructs.h:40
int give_att(int i) const
Definition: substructs.h:73
const Problem * Pd
Pointer to owner = parent problem.
Definition: subject.h:24
PointDOFsRANHN(long gid, const GeometryComponent *owner)
CONSTRUCTOR.
Definition: substructs.h:236
PointDOFsCondense(long gid, const Element *owner)
CONSTRUCTOR.
Definition: substructs.cpp:13
PointDOFsBCPM(const PointDOFsBCPM *src, const GeometryComponent *owner)
CONSTRUCTOR COPY.
Definition: substructs.h:139
virtual void checkConsistency(void) const
Checks data consistency.
Definition: substructs.h:58
void BC_support_all_rot_dofs(void)
Definition: substructs.h:185
Base class for management of DOF (Degrees Of Freedom) attributes at a node.
Definition: substructs.h:32
int give_mask(int i) const
Definition: substructs.h:74
Lvctr * resize_ignore_vals(long newsize)
resize, ignore values
Definition: arrays.h:472
#define _errorr(_1)
Definition: gelib.h:151
Derived class for management of boundary conditions and physical meanings of DOFs (Degrees Of Freedom...
Definition: substructs.h:131
bool mask_is_null(void) const
Definition: substructs.h:79
Subject.
DOFsPerNode give_DOFspnod(void) const
Definition: problem.h:256
void assemble_full_constrained(Lvctr *aa) const
Definition: substructs.h:162
Derived class for management of condensed DOFs (Degrees Of Freedom) at a node.
Definition: substructs.h:287
void fillYourselfBy(long val)
Set all elements of the array to the given value.
Definition: arrays.h:487
void set_att(int i, int val)
Definition: substructs.h:67
virtual ~PointDOFsBCPM()
DESTRUCTOR.
Definition: substructs.h:141
bool SP_scan_array(const char *&src, int n, ArgType *a)
... array of numbers
Definition: librw.h:233
bool SP_scan_number(const char *&src, int &dest)
... number of type int/long/double
Definition: librw.cpp:595
*** *** *** *** CLASS COMPONENT *** *** *** ***
Definition: geomcomp.h:22
virtual ~PointDOFsCondense()
DESTRUCTOR.
Definition: substructs.h:295
void scan_mask_ndofs_expected(const char *&str)
Definition: substructs.h:96
void set_ndofsatt(int n, long *val)
Definition: substructs.h:69
PointDOFsAttributes(long gid, const GeometryComponent *owner)
CONSTRUCTOR.
Definition: substructs.h:44
int give_global_nDOFs(void) const
Definition: problem.h:257
void set_elemDOFs_2nodesPERsixDOFs(void)
nastavit doff pro beam element, 2 uzly, 3d
Definition: substructs.h:209
void scan_att(const char *&str)
Definition: substructs.h:100
void scan_ndofs_expected(const char *&str)
Definition: substructs.h:94
void scan_mask(const char *&str)
Definition: substructs.h:101
int * att
Attribute array is "ndofs" long.
Definition: substructs.h:38
void scan_att_ndofs_expected(const char *&str)
Definition: substructs.h:95
void scan_att_new_sparse(const char *&str)
Definition: substructs.h:102
const GeometryComponent * give_GC(void) const
Definition: subject.h:101
void BC_att_SIFEL_NODEBC_revert(void)
*** BC ***
Definition: substructs.h:179
Problem description.
Definition: problem.h:74
int ndofs
Number of DOFs at a node.
Definition: substructs.h:36
void HN_initialize_slave_node(void)
hanging node
Definition: substructs.h:252
void fill_all_by(ArgType *p, long a, ArgType value)
*** *** *** *** FILL TEMPLATES *** *** *** ***
Definition: gelib.h:238