OOFEM 3.0
Loading...
Searching...
No Matches
lumpedmasselement.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
36#include "dofmanager.h"
37#include "dof.h"
38#include "floatmatrix.h"
39#include "floatarray.h"
40#include "intarray.h"
41#include "classfactory.h"
42#include "parametermanager.h"
43#include "paramkey.h"
44
45#ifdef __OOFEG
46 #include "oofeggraphiccontext.h"
47 #include "node.h"
48#endif
49
50namespace oofem {
52
55
56LumpedMassElement :: LumpedMassElement(int n, Domain *aDomain) : StructuralElement(n, aDomain)
57{
59}
60
61
62void
63LumpedMassElement :: computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep)
64{
65 int ndofs = this->computeNumberOfDofs();
66 answer.resize(ndofs, ndofs);
67 answer.zero();
68 answer.beDiagonal(this->components);
69}
70
71
72void
73LumpedMassElement :: initializeFrom(InputRecord &ir, int priority)
74{
75 ParameterManager &ppm = this->giveDomain()->elementPPM;
76 StructuralElement :: initializeFrom(ir, priority);
77 PM_UPDATE_PARAMETER(dofs, ppm, ir, this->number, IPK_LumpedMassElement_dofs, priority) ;
79
80}
81
82void
83LumpedMassElement :: postInitialize()
84{
85 ParameterManager &ppm = this->giveDomain()->elementPPM;
86 StructuralElement :: postInitialize();
89}
90
91int
92LumpedMassElement :: checkConsistency()
93{
94 int _result = StructuralElement :: checkConsistency();
95 if ( this->dofs.giveSize() != this->components.giveSize() ) {
96 OOFEM_WARNING("component/dof array size mismatch");
97 _result = 0;
98 }
99
100 return _result;
101}
102
103
104int
105LumpedMassElement :: computeNumberOfDofs()
106{
107 return dofs.giveSize();
108}
109
110
111void
112LumpedMassElement :: giveDofManDofIDMask(int inode, IntArray &answer) const
113{
114 answer = dofs;
115}
116
117#ifdef __OOFEG
118void LumpedMassElement :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
119{
120 GraphicObj *go;
121 WCRec p [ 1 ]; /* point */
122 if ( !gc.testElementGraphicActivity(this) ) {
123 return;
124 }
125
126 EASValsSetColor( gc.getElementColor() );
127 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
128 EASValsSetMType(SQUARE_MARKER);
129 EASValsSetMSize(8);
130 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
131 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
132 p [ 0 ].z = ( FPNum ) this->giveNode(1)->giveCoordinate(3);
133 go = CreateMarker3D(p);
134 EGWithMaskChangeAttributes(COLOR_MASK | LAYER_MASK | MTYPE_MASK | MSIZE_MASK, go);
135 EGAttachObject(go, ( EObjectP ) this);
136 EMAddGraphicsToModel(ESIModel(), go);
137}
138
139
140void LumpedMassElement :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
141{
142 GraphicObj *go;
143 double defScale = gc.getDefScale();
144 WCRec p [ 1 ]; /* point */
145 if ( !gc.testElementGraphicActivity(this) ) {
146 return;
147 }
148
149 EASValsSetColor( gc.getDeformedElementColor() );
150 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
151 EASValsSetMType(SQUARE_MARKER);
152 EASValsSetMSize(8);
153 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
154 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
155 p [ 0 ].z = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(3, tStep, defScale);
156 go = CreateMarker3D(p);
157 EGWithMaskChangeAttributes(COLOR_MASK | LAYER_MASK | MTYPE_MASK | MSIZE_MASK, go);
158 EGAttachObject(go, ( EObjectP ) this);
159 EMAddGraphicsToModel(ESIModel(), go);
160}
161
162
163void LumpedMassElement :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
164{ }
165
166#endif
167} // 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
Domain * giveDomain() const
Definition femcmpnn.h:97
int number
Component number.
Definition femcmpnn.h:77
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void beDiagonal(const FloatArray &diag)
void zero()
Zeroes all coefficient of receiver.
IntArray dofs
List of DOFs.
static ParamKey IPK_LumpedMassElement_dofs
static ParamKey IPK_LumpedMassElement_components
FloatArray components
Mass and moments of inertia corresponding to the specified DOFs.
StructuralElement(int n, Domain *d)
#define OOFEM_WARNING(...)
Definition error.h:80
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
#define OOFEG_DEFORMED_GEOMETRY_LAYER
#define OOFEG_RAW_GEOMETRY_LAYER
#define PM_ELEMENT_ERROR_IFNOTSET(_pm, _componentnum, _paramkey)
#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