OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
tetrah1_ht.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 "tetrah1_ht.h"
36 #include "gausspoint.h"
37 #include "gaussintegrationrule.h"
38 #include "floatmatrix.h"
39 #include "floatarray.h"
40 #include "intarray.h"
41 #include "mathfem.h"
42 #include "crosssection.h"
43 #include "fei3dtetlin.h"
44 #include "classfactory.h"
45 
46 #ifdef __OOFEG
47  #include "oofeggraphiccontext.h"
48  #include "oofegutils.h"
49 #endif
50 
51 namespace oofem {
52 REGISTER_Element(Tetrah1_ht);
53 REGISTER_Element(Tetrah1_hmt);
54 
55 FEI3dTetLin Tetrah1_ht :: interpolation;
56 
58 {
59  numberOfDofMans = 4;
61 }
62 
63 Tetrah1_hmt :: Tetrah1_hmt(int n, Domain *aDomain) : Tetrah1_ht(n, aDomain)
64 {
65  this->emode = HeatMass1TransferEM; // This could be done in a better way.
66 }
67 
69 { }
70 
71 
74 {
75  return & interpolation;
76 }
77 
78 
79 void
81 // Sets up the array containing the four Gauss points of the receiver.
82 {
83  if ( integrationRulesArray.size() == 0 ) {
84  integrationRulesArray.resize( 1 );
85  integrationRulesArray [ 0 ].reset( new GaussIntegrationRule(1, this, 1, 2) );
87  }
88 }
89 
90 
93 {
96 }
97 
98 
99 double
101 // Returns the portion of the receiver which is attached to gp.
102 {
103  double determinant, weight, volume;
104  determinant = fabs( this->interpolation.giveTransformationJacobian( gp->giveNaturalCoordinates(),
105  FEIElementGeometryWrapper(this) ) );
106 
107  weight = gp->giveWeight();
108  volume = determinant * weight;
109  return volume;
110 }
111 
112 
113 double
115 {
116  double result = this->interpolation.edgeGiveTransformationJacobian( iEdge, gp->giveNaturalCoordinates(),
118  return result *gp->giveWeight();
119 }
120 
121 
124 {
125  IntegrationRule *iRule = new GaussIntegrationRule(1, this, 1, 1);
126  int npoints = iRule->getRequiredNumberOfIntegrationPoints(_Triangle, approxOrder);
127  iRule->SetUpPointsOnTriangle(npoints, _Unknown);
128  return iRule;
129 }
130 
131 
132 double
134 {
135  double detJ, weight;
137 
138  weight = gp->giveWeight();
139  return detJ * weight;
140 }
141 
142 
143 Interface *
145 {
146  if ( interface == SpatialLocalizerInterfaceType ) {
147  return static_cast< SpatialLocalizerInterface * >(this);
148  } else if ( interface == EIPrimaryFieldInterfaceType ) {
149  return static_cast< EIPrimaryFieldInterface * >(this);
150  } else if ( interface == ZZNodalRecoveryModelInterfaceType ) {
151  return static_cast< ZZNodalRecoveryModelInterface * >(this);
152  }
153 
154  return NULL;
155 }
156 
157 
158 #ifdef __OOFEG
159  #define TR_LENGHT_REDUCT 0.3333
160 
161 void
163 {
164  WCRec p [ 4 ];
165  GraphicObj *go;
166 
167  if ( !gc.testElementGraphicActivity(this) ) {
168  return;
169  }
170 
171  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
172  EASValsSetColor( gc.getElementColor() );
173  EASValsSetEdgeColor( gc.getElementEdgeColor() );
174  EASValsSetEdgeFlag(true);
175  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
176  EASValsSetFillStyle(FILL_SOLID);
177  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
178  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
179  p [ 0 ].z = ( FPNum ) this->giveNode(1)->giveCoordinate(3);
180  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
181  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
182  p [ 1 ].z = ( FPNum ) this->giveNode(2)->giveCoordinate(3);
183  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
184  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
185  p [ 2 ].z = ( FPNum ) this->giveNode(3)->giveCoordinate(3);
186  p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveCoordinate(1);
187  p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveCoordinate(2);
188  p [ 3 ].z = ( FPNum ) this->giveNode(4)->giveCoordinate(3);
189 
190  go = CreateTetra(p);
191  EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
192  EGAttachObject(go, ( EObjectP ) this);
193  EMAddGraphicsToModel(ESIModel(), go);
194 }
195 
196 
197 void
199 {
200  int i, indx, result = 0;
201  WCRec p [ 4 ];
202  GraphicObj *tr;
203  FloatArray v [ 4 ];
204  double s [ 4 ];
205 
206  if ( !gc.testElementGraphicActivity(this) ) {
207  return;
208  }
209 
210  if ( gc.giveIntVarMode() == ISM_recovered ) {
211  for ( i = 1; i <= 4; i++ ) {
212  result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
213  }
214 
215  if ( result != 4 ) {
216  return;
217  }
218  } else if ( gc.giveIntVarMode() == ISM_local ) {
219  return;
220  }
221 
222  indx = gc.giveIntVarIndx();
223 
224  for ( i = 1; i <= 4; i++ ) {
225  s [ i - 1 ] = v [ i - 1 ].at(indx);
226  }
227 
228  EASValsSetEdgeColor( gc.getElementEdgeColor() );
229  EASValsSetEdgeFlag(true);
230  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
231  if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
232  for ( i = 0; i < 4; i++ ) {
233  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
234  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
235  p [ i ].z = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(3);
236  }
237 
238  gc.updateFringeTableMinMax(s, 4);
239  tr = CreateTetraWD(p, s);
240  EGWithMaskChangeAttributes(LAYER_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK, tr);
241  EMAddGraphicsToModel(ESIModel(), tr);
242  }
243 }
244 
245 #endif
246 } // end namespace oofem
CrossSection * giveCrossSection()
Definition: element.C:495
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
int giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode, int node, TimeStep *tStep)
Returns internal state variable (like stress,strain) at node of element in Reduced form...
Class and object Domain.
Definition: domain.h:115
ScalarAlgorithmType getScalarAlgo()
The element interface required by ZZNodalRecoveryModel.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
#define OOFEG_RAW_GEOMETRY_LAYER
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual double giveCoordinate(int i)
Definition: node.C:82
Tetrahedral (3d) element with linear approximation for heat and mass transfer.
Definition: tetrah1_ht.h:51
virtual double computeSurfaceVolumeAround(GaussPoint *gp, int iEdge)
Definition: tetrah1_ht.C:133
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation.
Definition: fei3dtetlin.C:178
virtual Interface * giveInterface(InterfaceType t)
Interface requesting service.
Definition: tetrah1_ht.C:144
Abstract base class representing integration rule.
Tetrah1_hmt(int n, Domain *d)
Definition: tetrah1_ht.C:63
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
static FEI3dTetLin interpolation
Definition: tetrah1_ht.h:54
virtual double computeEdgeVolumeAround(GaussPoint *gp, int iEdge)
Computes the length around a integration point on a edge.
Definition: tetrah1_ht.C:114
Element interface class.
Definition: primaryfield.h:58
InternalStateType giveIntVarType()
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
Definition: tetrah1_ht.C:80
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: element.C:638
REGISTER_Element(LSpace)
virtual IntegrationRule * GetSurfaceIntegrationRule(int approxOrder)
Definition: tetrah1_ht.C:123
#define OOFEG_RAW_GEOMETRY_WIDTH
virtual double giveWeight()
Returns integration weight of receiver.
Definition: gausspoint.h:181
This abstract class represent a general base element class for transport problems.
Wrapper around element definition to provide FEICellGeometry interface.
Definition: feinterpol.h:95
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Definition: tetrah1_ht.C:198
virtual double surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the edge jacobian of transformation between local and global coordinates.
Definition: fei3dtetlin.C:380
Tetrah1_ht(int n, Domain *d)
Definition: tetrah1_ht.C:57
virtual int setupIntegrationPoints(IntegrationRule &irule, int npoints, Element *element)
Sets up integration rule for the given element.
Definition: crosssection.C:54
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
InternalStateMode giveIntVarMode()
virtual FEInterpolation * giveInterpolation() const
Definition: tetrah1_ht.C:73
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: tetrah1_ht.C:92
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual int getRequiredNumberOfIntegrationPoints(integrationDomain dType, int approxOrder)
Abstract service.
Class Interface.
Definition: interface.h:82
virtual ~Tetrah1_ht()
Definition: tetrah1_ht.C:68
The spatial localizer element interface associated to spatial localizer.
std::vector< std::unique_ptr< IntegrationRule > > integrationRulesArray
List of integration rules of receiver (each integration rule contains associated integration points a...
Definition: element.h:170
virtual int SetUpPointsOnTriangle(int, MaterialMode mode)
Sets up receiver&#39;s integration points on triangular (area coords) integration domain.
virtual double computeVolumeAround(GaussPoint *gp)
Returns volume related to given integration point.
Definition: tetrah1_ht.C:100
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
void updateFringeTableMinMax(double *s, int size)
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: tetrah1_ht.C:162
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
#define OOFEG_VARPLOT_PATTERN_LAYER
Class representing integration point in finite element program.
Definition: gausspoint.h:93
virtual double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the edge jacobian of transformation between local and global coordinates.
Definition: fei3dtetlin.C:262
Class representing solution step.
Definition: timestep.h:80
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Definition: gausspoint.h:138
Class representing Gaussian-quadrature integration rule.

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:31 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011