OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
gausspoint.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 "gausspoint.h"
36 #include "matstatus.h"
37 #include "material.h"
38 
39 #include <memory>
40 
41 namespace oofem {
42 //GaussPoint :: GaussPoint(IntegrationRule *ir, int n, FloatArray *a, double w, MaterialMode mode) : statusDict()
43 GaussPoint :: GaussPoint(IntegrationRule *ir, int n, FloatArray iNaturalCoord, double w, MaterialMode mode) :
44  number(n),
45  irule(ir),
46  naturalCoordinates(std :: move(iNaturalCoord)),
47  weight(w),
48  materialMode(mode)
49 {
50  subPatchCoordinates = NULL;
51  globalCoordinates = NULL;
52  materialStatus = NULL;
53 }
54 
56  number(n),
57  irule(ir),
58  weight(w),
59  materialMode(mode)
60 {
61  subPatchCoordinates = NULL;
62  globalCoordinates = NULL;
63  materialStatus = NULL;
64 }
65 
67 {
68  for ( GaussPoint *gp: gaussPoints ) {
69  delete gp;
70  }
71 
72  delete subPatchCoordinates;
73  delete globalCoordinates;
74  delete materialStatus;
75 }
76 
77 
78 void GaussPoint :: printOutputAt(FILE *File, TimeStep *tStep)
79 // Prints the strains and stresses on the data file.
80 {
81  int iruleNumber = 0;
82 
83  if ( irule ) {
84  iruleNumber = irule->giveNumber();
85  }
86 
87  fprintf(File, " GP %2d.%-2d :", iruleNumber, number);
88 
89  // invoke printOutputAt method for all managed statuses
91  if ( status ) {
92  status->printOutputAt(File, tStep);
93  }
94 
95  if ( gaussPoints.size() != 0 ) { // layered material
96  fprintf(File, "Layers report \n{\n");
97  for ( GaussPoint *gp: gaussPoints ) {
98  gp->printOutputAt(File, tStep);
99  }
100 
101  fprintf(File, "} end layers report\n");
102  }
103 }
104 
105 
107 // returns receivers slave gauss point
108 // 'slaves' are introduced in order to support various type
109 // of cross sections models (for example layered material, where
110 // each separate layer has its own slave gp.)
111 //
112 {
113  if ( gaussPoints.size() == 0 ) {
114  return NULL;
115  }
116 
117  if ( ( index < 0 ) || ( index >= (int)gaussPoints.size() ) ) {
118  OOFEM_ERROR("index out of range");
119  }
120 
121  return gaussPoints [ index ];
122 }
123 
125  if ( this->gaussPoints.size() != 0 ) {// layered material
126  return true;
127  }
128  return false;
129 }
130 
132  std::vector< GaussPoint * >::iterator it;
133  it = find( gaussPoints.begin(), gaussPoints.end(), gp );
134  if ( it != gaussPoints.end() ) {
135  return it - gaussPoints.begin();
136  } else {
137  OOFEM_ERROR("Slave Gauss point not found.");
138  }
139 }
140 
142 // Performs end-of-step updates.
143 {
144  IntegrationPointStatus *status = this->giveMaterialStatus();
145  if ( status ) {
146  status->updateYourself(tStep);
147  }
148 
149  for ( GaussPoint *gp: gaussPoints ) {
150  gp->updateYourself(tStep);
151  }
152 }
153 
154 
155 
156 /*
157  * contextIOResultType
158  * GaussPoint :: saveContext (FILE* stream, void *obj)
159  * //
160  * // saves full gp context (saves state variables, that completely describe
161  * // current state)
162  * // does not saves the slave - records
163  * // this task is done at the layeredCrossSection level
164  * {
165  *
166  * contextIOResultType iores;
167  *
168  * if ((iores = this->giveMaterial()->saveContext(stream,(void*) this)) != CIO_OK) THROW_CIOERR(iores);
169  * // if (matStatusDict->saveContext(stream,obj) != 1)
170  * // error ("saveContext io error encountered");
171  *
172  * return CIO_OK;
173  *
174  * }
175  *
176  *
177  * contextIOResultType
178  * GaussPoint :: restoreContext (FILE* stream, void *obj)
179  * //
180  * // restores full material context (saves state variables, that completely describe
181  * // current state)
182  * // does not restores the slave - records
183  * // this task is done at the layeredCrossSection level
184  * //
185  * {
186  *
187  * contextIOResultType iores;
188  * if ((iores = this->giveMaterial()->restoreContext(stream,(void*) this)) != CIO_OK) THROW_CIOERR(iores);
189  * //if (matStatusDict->restoreContext(stream,obj) != 1)
190  * // error ("restoreContext io error encountered");
191  *
192  * return CIO_OK;
193  *
194  * }
195  */
196 } // end namespace oofem
virtual ~GaussPoint()
Destructor.
Definition: gausspoint.C:66
FloatArray * globalCoordinates
Optional global (Cartesian) coordinates.
Definition: gausspoint.h:105
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
bool hasSlaveGaussPoint()
True if gauss point has slave points.
Definition: gausspoint.C:124
int giveNumber()
Returns receiver number.
GaussPoint * giveSlaveGaussPoint(int index)
Returns index-th slave gauss point of receiver.
Definition: gausspoint.C:106
MaterialMode
Type representing material mode of integration point.
Definition: materialmode.h:89
double weight
Integration weight.
Definition: gausspoint.h:107
Abstract base class representing integration rule.
GaussPoint(IntegrationRule *ir, int n, FloatArray iNaturalCoord, double w, MaterialMode mode)
Creates integration point belonging to given integration rule, with given number, integration weight...
Definition: gausspoint.C:43
virtual void updateYourself(TimeStep *tStep)
Updates internal state of receiver after finishing time step.
Definition: gausspoint.C:141
size_t findFirstIndexOfSlaveGaussPoint(GaussPoint *gp)
Finds index of slave point in an array.
Definition: gausspoint.C:131
#define OOFEM_ERROR(...)
Definition: error.h:61
int number
Number.
Definition: gausspoint.h:97
IntegrationRule * irule
Reference to parent integration rule.
Definition: gausspoint.h:99
Class representing vector of real numbers.
Definition: floatarray.h:82
MaterialMode materialMode
Material mode of receiver.
Definition: gausspoint.h:109
IntegrationPointStatus * giveMaterialStatus()
Returns reference to associated material status (NULL if not defined).
Definition: gausspoint.h:205
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to file.
Definition: gausspoint.C:78
std::vector< GaussPoint * > gaussPoints
List of slave integration points.
Definition: gausspoint.h:114
FloatArray * subPatchCoordinates
Optional local sub-patch (sub-patches form element volume) coordinates of the receiver.
Definition: gausspoint.h:103
virtual void updateYourself(TimeStep *)
Update equilibrium history variables according to temp-variables.
the oofem namespace is to define a context or scope in which all oofem names are defined.
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
Abstract base class representing a integration status.
IntegrationPointStatus * materialStatus
Status of e.g. material in point.
Definition: gausspoint.h:116

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