OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 2013 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 
35 #include "../sm/Elements/lumpedmasselement.h"
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 
43 #ifdef __OOFEG
44  #include "oofeggraphiccontext.h"
45  #include "node.h"
46 #endif
47 
48 namespace oofem {
49 REGISTER_Element(LumpedMassElement);
50 
52 {
53  numberOfDofMans = 1;
54 }
55 
56 
57 void
59 {
60  int ndofs = this->computeNumberOfDofs();
61  answer.resize(ndofs, ndofs);
62  answer.zero();
63  answer.beDiagonal(this->components);
64 }
65 
66 
69 {
70  IRResultType result; // Required by IR_GIVE_FIELD macro
71 
74 
76 }
77 
78 
79 int
81 {
83  if ( this->dofs.giveSize() != this->components.giveSize() ) {
84  OOFEM_WARNING("component/dof array size mismatch");
85  _result = 0;
86  }
87 
88  return _result;
89 }
90 
91 
92 int
94 {
95  return dofs.giveSize();
96 }
97 
98 
99 void
101 {
102  answer = dofs;
103 }
104 
105 #ifdef __OOFEG
107 {
108  GraphicObj *go;
109  WCRec p [ 1 ]; /* point */
110  if ( !gc.testElementGraphicActivity(this) ) {
111  return;
112  }
113 
114  EASValsSetColor( gc.getElementColor() );
115  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
116  EASValsSetMType(SQUARE_MARKER);
117  EASValsSetMSize(8);
118  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
119  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
120  p [ 0 ].z = ( FPNum ) this->giveNode(1)->giveCoordinate(3);
121  go = CreateMarker3D(p);
122  EGWithMaskChangeAttributes(COLOR_MASK | LAYER_MASK | MTYPE_MASK | MSIZE_MASK, go);
123  EGAttachObject(go, ( EObjectP ) this);
124  EMAddGraphicsToModel(ESIModel(), go);
125 }
126 
127 
129 {
130  GraphicObj *go;
131  double defScale = gc.getDefScale();
132  WCRec p [ 1 ]; /* point */
133  if ( !gc.testElementGraphicActivity(this) ) {
134  return;
135  }
136 
137  EASValsSetColor( gc.getDeformedElementColor() );
138  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
139  EASValsSetMType(SQUARE_MARKER);
140  EASValsSetMSize(8);
141  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
142  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
143  p [ 0 ].z = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(3, tStep, defScale);
144  go = CreateMarker3D(p);
145  EGWithMaskChangeAttributes(COLOR_MASK | LAYER_MASK | MTYPE_MASK | MSIZE_MASK, go);
146  EGAttachObject(go, ( EObjectP ) this);
147  EMAddGraphicsToModel(ESIModel(), go);
148 }
149 
150 
152 { }
153 
154 #endif
155 } // end namespace oofem
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
LumpedMassElement(int n, Domain *d)
Class and object Domain.
Definition: domain.h:115
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType)
#define OOFEG_RAW_GEOMETRY_LAYER
virtual void giveDofManDofIDMask(int inode, IntArray &answer) const
Returns dofmanager dof mask for node.
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
#define _IFT_LumpedMassElement_components
void beDiagonal(const FloatArray &diag)
Modifies receiver to be a diagonal matrix with the components specified in diag.
Definition: floatmatrix.C:1433
virtual void computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep)
Computes lumped mass matrix of receiver.
virtual double giveCoordinate(int i)
Definition: node.C:82
Class implementing an array of integers.
Definition: intarray.h:61
#define _IFT_LumpedMassElement_dofs
#define OOFEG_DEFORMED_GEOMETRY_LAYER
Abstract base class for all "structural" finite elements.
virtual int checkConsistency()
Performs consistency check.
REGISTER_Element(LSpace)
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
UnknownType
Type representing particular unknown (its physical meaning).
Definition: unknowntype.h:55
virtual double giveUpdatedCoordinate(int ic, TimeStep *tStep, double scale=1.)
Returns updated ic-th coordinate of receiver.
Definition: node.C:245
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual int checkConsistency()
Performs consistency check.
IntArray dofs
List of DOFs.
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
int giveSize() const
Definition: intarray.h:203
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
FloatArray components
Mass and moments of inertia corresponding to the specified DOFs.
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
#define OOFEM_WARNING(...)
Definition: error.h:62
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Class representing solution step.
Definition: timestep.h:80
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
virtual int computeNumberOfDofs()
Computes or simply returns total number of element's local DOFs.

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011