OOFEM 3.0
Loading...
Searching...
No Matches
intelpoint.C
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
37#include "domain.h"
38#include "node.h"
40#include "floatmatrix.h"
41#include "floatarray.h"
42#include "intarray.h"
43#include "mathfem.h"
44#include "classfactory.h"
45#include "parametermanager.h"
46#include "paramkey.h"
47//#include "floatarrayf.h"
48
49#ifdef __OOFEG
50 #include "oofeggraphiccontext.h"
51
52 #include <Emarkwd3d.h>
53#endif
54
55namespace oofem {
61
62IntElPoint :: IntElPoint(int n, Domain *aDomain) :
64{
66 length = 1.;
67 area = 1.;
68}
69
70
71void
72IntElPoint :: setCoordMode()
73{
74 switch ( domain->giveNumberOfSpatialDimensions() ) {
75 case 1:
76 this->mode = ie1d_1d;
77 break;
78 case 2:
79 this->mode = ie1d_2d;
80 break;
81 case 3:
82 this->mode = ie1d_3d;
83 break;
84 default:
85 OOFEM_ERROR("Unsupported domain type")
86 }
87}
88
89
90MaterialMode
91IntElPoint :: giveMaterialMode()
92{
94 switch ( mode ) {
95 case ie1d_1d: return _1dInterface;
96
97 case ie1d_2d: return _2dInterface;
98
99 case ie1d_3d: return _3dInterface;
100
101 default: OOFEM_ERROR("Unsupported coord mode");
102 }
103 //return _1dInterface; // to make the compiler happy
104}
105
106
107void
108IntElPoint :: computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)
109//
110// Returns linear part of geometrical equations of the receiver at gp.
111// Returns the linear part of the B matrix
112//
113{
114 setCoordMode();
115
116 switch ( mode ) {
117 case ie1d_1d:
118 answer.resize(1, 2);
119 answer.at(1, 1) = -1.0;
120 answer.at(1, 2) = +1.0;
121 break;
122 case ie1d_2d:
123 answer.resize(2, 4);
124 answer.zero();
125 answer.at(1, 1) = -1.0;
126 answer.at(1, 3) = +1.0;
127 answer.at(2, 2) = -1.0;
128 answer.at(2, 4) = +1.0;
129 break;
130 case ie1d_3d:
131 answer.resize(3, 6);
132 answer.zero();
133 answer.at(1, 1) = -1.0;
134 answer.at(1, 4) = +1.0;
135 answer.at(2, 2) = -1.0;
136 answer.at(2, 5) = +1.0;
137 answer.at(3, 3) = -1.0;
138 answer.at(3, 6) = +1.0;
139 break;
140 default:
141 OOFEM_ERROR("Unsupported mode");
142 }
143
144}
145
146
147void
148IntElPoint :: computeTransformationMatrixAt(GaussPoint *gp, FloatMatrix &answer)
149{
150 // Computes transformation matrix to local coordinate system.
151 setCoordMode();
152 switch ( mode ) {
153 case ie1d_1d:
154 answer.resize(1, 1);
155 answer.at(1, 1) = 1.;
156 return;
157
158 case ie1d_2d:
159 answer.resize(2, 2);
160 answer.at(1, 1) = normal.at(1);
161 answer.at(1, 2) = normal.at(2);
162 answer.at(2, 1) = -normal.at(2);
163 answer.at(2, 2) = normal.at(1);
164 return;
165
166 case ie1d_3d:
167 {
168 //FloatMatrix test;
169 //test.beLocalCoordSys(normal.normalize());
170
172 if ( fabs( normal.at(1) ) > fabs( normal.at(2) ) ) {
173 ly.at(2) = 1.;
174 } else {
175 ly.at(1) = 1.;
176 }
177
178 auto lz = cross(normal, ly);
179 lz /= norm(lz);
180 ly = cross(lz, normal);
181 ly /= norm(ly);
182
183 answer.resize(3, 3);
184 for ( int i = 1; i <= 3; i++ ) {
185 answer.at(1, i) = normal.at(i);
186 answer.at(2, i) = ly.at(i);
187 answer.at(3, i) = lz.at(i);
188 }
189
190 return;
191 }
192
193 default:
194 OOFEM_ERROR("Unsupported mode");
195 }
196}
197
198
199void
200IntElPoint :: computeGaussPoints()
201{
202 if ( integrationRulesArray.size() == 0 ) {
203 integrationRulesArray.resize(1);
204 integrationRulesArray [ 0 ] = std::make_unique<GaussIntegrationRule>(1, this, 1, 2);
205 integrationRulesArray [ 0 ]->setUpIntegrationPoints( _Line, 1, this->giveMaterialMode() );
206 }
207}
208
209
210int
211IntElPoint :: computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
212{
213 answer = this->giveNode(1)->giveCoordinates();
214 answer.add(this->giveNode(2)->giveCoordinates());
215 answer.times(0.5);
216 return 1;
217}
218
219
220
221double
222IntElPoint :: computeAreaAround(GaussPoint *gp)
223{
224 if ( (this->giveCrossSection()->hasProperty(CS_Thickness)) ) {
225 double thickness = this->giveCrossSection()->give(CS_Thickness, gp);
226 return thickness*this->length;
227 } else {
228 // The modeled area/extension around the connected nodes.
229 // Compare with the cs area of a bar. ///@todo replace with cs-property? /JB
230 return this->area;
231 }
232}
233
234
235void
236IntElPoint :: initializeFrom(InputRecord &ir, int priority)
237{
238 // Initialize the receiver from the given input record.
239 bool flag;
240 ParameterManager & ppm = this->giveDomain()->elementPPM;
241 StructuralInterfaceElement :: initializeFrom(ir, priority);
242
244 FloatArray n;
245 PM_UPDATE_PARAMETER_AND_REPORT(n, ppm, ir, this->number, IPK_IntElPoint_normal, priority, flag);
246 if (flag) {
247 normal = n;
248 }
249 //PM_UPDATE_PARAMETER(referenceNode, ppm, ir, this->number, IPK_IntElPoint_refnode, priority);
250 PM_UPDATE_PARAMETER(area, ppm, ir, this->number, IPK_IntElPoint_area, priority);
251 PM_UPDATE_PARAMETER(length, ppm, ir, this->number, IPK_IntElPoint_length, priority);
252}
253
254void
255IntElPoint :: postInitialize()
256{
257 StructuralInterfaceElement :: postInitialize();
258 ParameterManager & ppm = this->giveDomain()->elementPPM;
259 bool refnodeFlag = ppm.checkIfSet(this->number, IPK_IntElPoint_refnode.getIndex());
260 bool normalFlag = ppm.checkIfSet(this->number, IPK_IntElPoint_normal.getIndex());
261 if ( refnodeFlag && normalFlag ) {
262 OOFEM_ERROR("Ambiguous input: 'refnode' and 'normal' cannot both be specified");
263 }
264 this->computeLocalSlipDir();
265}
266
267int
268IntElPoint :: computeNumberOfDofs()
269{
270 setCoordMode();
271 switch ( mode ) {
272 case ie1d_1d:
273 return 2;
274
275 case ie1d_2d:
276 return 4;
277
278 case ie1d_3d:
279 return 6;
280
281 default:
282 OOFEM_ERROR("Unsupported mode");
283 }
284
285 //return 0; // to suppress compiler warning
286}
287
288
289void
290IntElPoint :: giveDofManDofIDMask(int inode, IntArray &answer) const
291{
292
293 switch ( domain->giveNumberOfSpatialDimensions() ) {
294 case 1:
295 answer = IntArray{ D_u };
296 break;
297 case 2:
298 answer = { D_u, D_v };
299 break;
300 case 3:
301 answer = { D_u, D_v, D_w };
302 break;
303 default:
304 OOFEM_ERROR("Unsupported mode");
305 }
306
307}
308
309
310void
311IntElPoint :: computeLocalSlipDir(void)
312{
313 if ( this->referenceNode ) {
314 // normal
315 normal = domain->giveNode(this->referenceNode)->giveCoordinates() - this->giveNode(1)->giveCoordinates();
316 } else {
317
318 if ( normal.at(1) == 0. && normal.at(2) == 0. && normal.at(3) == 0. ) {
319 // let the element compute the slip direction if the nodes' cooridantes are different
320 normal = this->giveNode(2)->giveCoordinates() - this->giveNode(1)->giveCoordinates();
321
322 // final check
323 if ( normal.at(1) == 0. && normal.at(2) == 0. && normal.at(3) == 0. ) {
324 OOFEM_ERROR("Normal is not defined (referenceNode=0,normal=(0,0,0))");
325 }
326 }
327 }
328
329 normal /= norm(normal);
330}
331
332
333#ifdef __OOFEG
334void IntElPoint :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
335{
336 GraphicObj *go;
337 // if (!go) { // create new one
338 WCRec p [ 1 ]; /* poin */
339 if ( !gc.testElementGraphicActivity(this) ) {
340 return;
341 }
342
343 EASValsSetColor( gc.getElementColor() );
344 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
345 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
346 EASValsSetColor( gc.getDeformedElementColor() );
347 p [ 0 ].x = ( FPNum ) ( this->giveNode(1)->giveCoordinate(1) );
348 p [ 0 ].y = ( FPNum ) ( this->giveNode(1)->giveCoordinate(2) );
349 p [ 0 ].z = ( FPNum ) ( this->giveNode(1)->giveCoordinate(3) );
350
351 EASValsSetMType(CIRCLE_MARKER);
352 go = CreateMarker3D(p);
353 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
354 EMAddGraphicsToModel(ESIModel(), go);
355}
356
357
358void IntElPoint :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
359{
360 GraphicObj *go;
361 // if (!go) { // create new one
362 WCRec p [ 1 ]; /* poin */
363 if ( !gc.testElementGraphicActivity(this) ) {
364 return;
365 }
366
367 double defScale = gc.getDefScale();
368
369 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
370 EASValsSetColor( gc.getDeformedElementColor() );
371 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
372 p [ 0 ].x = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale) +
373 this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale) );
374 p [ 0 ].y = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale) +
375 this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale) );
376 p [ 0 ].z = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(3, tStep, defScale) +
377 this->giveNode(2)->giveUpdatedCoordinate(3, tStep, defScale) );
378
379 EASValsSetMType(CIRCLE_MARKER);
380 go = CreateMarker3D(p);
381 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
382 EMAddGraphicsToModel(ESIModel(), go);
383}
384
385
386void IntElPoint :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
387{
388 int indx, result = 0;
390 FloatArray gcoord(3), v1;
391 WCRec p [ 1 ];
392 GraphicObj *go;
393 double val [ 1 ];
394
395 if ( !gc.testElementGraphicActivity(this) ) {
396 return;
397 }
398
399 if ( gc.getInternalVarsDefGeoFlag() ) {
400 double defScale = gc.getDefScale();
401 p [ 0 ].x = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale) +
402 this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale) );
403 p [ 0 ].y = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale) +
404 this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale) );
405 p [ 0 ].z = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(3, tStep, defScale) +
406 this->giveNode(2)->giveUpdatedCoordinate(3, tStep, defScale) );
407 } else {
408 p [ 0 ].x = ( FPNum ) ( this->giveNode(1)->giveCoordinate(1) );
409 p [ 0 ].y = ( FPNum ) ( this->giveNode(1)->giveCoordinate(2) );
410 p [ 0 ].z = ( FPNum ) ( this->giveNode(1)->giveCoordinate(3) );
411 }
412
413 result += giveIPValue(v1, iRule->getIntegrationPoint(0), gc.giveIntVarType(), tStep);
414
415
416 for ( auto &gp: *iRule ) {
417 result = 0;
418 result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
419 if ( result != 1 ) {
420 continue;
421 }
422
423 indx = gc.giveIntVarIndx();
424
425 val [ 0 ] = v1.at(indx);
426 gc.updateFringeTableMinMax(val, 1);
427
428 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
429 EASValsSetMType(FILLED_CIRCLE_MARKER);
430 go = CreateMarkerWD3D(p, val [ 0 ]);
431 EGWithMaskChangeAttributes(LAYER_MASK | FILL_MASK | MTYPE_MASK, go);
432 EMAddGraphicsToModel(ESIModel(), go);
433 //}
434 }
435}
436#endif
437
438} // end namespace oofem
#define REGISTER_Element(class)
Node * giveNode(int i) const
Definition element.h:629
int numberOfDofMans
Number of dofmanagers.
Definition element.h:136
std::vector< std ::unique_ptr< IntegrationRule > > integrationRulesArray
Definition element.h:157
CrossSection * giveCrossSection()
Definition element.C:534
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Definition element.h:886
Domain * giveDomain() const
Definition femcmpnn.h:97
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
int number
Component number.
Definition femcmpnn.h:77
double & at(std::size_t i)
double & at(Index i)
Definition floatarray.h:202
void add(const FloatArray &src)
Definition floatarray.C:218
void times(double s)
Definition floatarray.C:834
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void zero()
Zeroes all coefficient of receiver.
double at(std::size_t i, std::size_t j) const
static ParamKey IPK_IntElPoint_normal
Definition intelpoint.h:74
MaterialMode giveMaterialMode() override
Definition intelpoint.C:91
static ParamKey IPK_IntElPoint_refnode
Definition intelpoint.h:73
FloatArrayF< 3 > normal
Definition intelpoint.h:69
enum oofem::IntElPoint::cmode mode
static ParamKey IPK_IntElPoint_area
Definition intelpoint.h:75
void computeLocalSlipDir(void)
Definition intelpoint.C:311
static ParamKey IPK_IntElPoint_length
Definition intelpoint.h:76
GaussPoint * getIntegrationPoint(int n)
bool checkIfSet(size_t componentIndex, size_t paramIndex)
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
#define OOFEM_ERROR(...)
Definition error.h:79
double norm(const FloatArray &x)
@ CS_Thickness
Thickness.
FloatArrayF< 3 > cross(const FloatArrayF< 3 > &x, const FloatArrayF< 3 > &y)
Computes $ x \cross y $.
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
#define OOFEG_VARPLOT_PATTERN_LAYER
#define OOFEG_DEFORMED_GEOMETRY_LAYER
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_LAYER
#define PM_UPDATE_PARAMETER_AND_REPORT(_val, _pm, _ir, _componentnum, _paramkey, _prio, _flag)
#define PM_UPDATE_PARAMETER(_val, _pm, _ir, _componentnum, _paramkey, _prio)

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011