OOFEM  2.4 OOFEM.org - Object Oriented Finite Element Solver
dofmanvalfield.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
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 "dofmanvalfield.h"
36 #include "domain.h"
37 #include "spatiallocalizer.h"
38 #include "element.h"
39 #include "timestep.h"
40 #include "dofmanager.h"
41 #include "feinterpol.h"
42
43 namespace oofem {
45 {
46  int ndofman = d->giveNumberOfDofManagers();
47  this->domain = d;
48  this->dmanvallist.resize(ndofman);
49 }
50
51 int
53 {
54  int result = 0; // assume ok
55  FloatArray lc, n;
56
57  // request element containing target point
59  if ( elem ) { // ok element containing target point found
60  FEInterpolation *interp = elem->giveInterpolation();
61  if ( interp ) {
62  // map target point to element local coordinates
63  if ( interp->global2local( lc, coords, FEIElementGeometryWrapper(elem) ) ) {
64  // evaluate interpolation functions at target point
65  interp->evalN( n, lc, FEIElementGeometryWrapper(elem) );
66  // loop over element nodes
67  for ( int i = 1; i <= n.giveSize(); i++ ) {
68  // multiply nodal value by value of corresponding shape function and add this to answer
70  }
71  } else { // mapping from global to local coordinates failed
72  result = 1; // failed
73  }
74  } else { // element without interpolation
75  result = 1; // failed
76  }
77  } else { // no element containing given point found
78  result = 1; // failed
79  }
80  return result;
81 }
82
83 int
85 {
87  return 1;
88 }
89
90 void
92 {
93  this->dmanvallist[dofMan-1] = std :: move(value);
94 }
95
98 {
99  return CIO_OK;
100 }
101
104 {
105  return CIO_OK;
106 }
107 } // end namespace oofem
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the array of interpolation functions (shape functions) at given point.
Class and object Domain.
Definition: domain.h:115
int giveDofManagerNumber(int i) const
Translates local to global indices for dof managers.
Definition: element.h:590
FieldType
Physical type of field.
Definition: field.h:60
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode)
Restores the receiver state previously written in stream.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
std::vector< FloatArray > dmanvallist
Array of dofman values.
Abstract base class for all finite elements.
Definition: element.h:145
Base class for dof managers.
Definition: dofmanager.h:113
DofManValueField(FieldType b, Domain *d)
Constructor.
virtual FEInterpolation * giveInterpolation() const
Definition: element.h:629
void setDofManValue(int dofMan, FloatArray value)
Sets the value associated to given dofManager.
Domain * domain
Associated domain (need its elements to interpolate)
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores receiver state to output stream.
Abstract class representing field.
Definition: field.h:80
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
virtual int evaluateAt(FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep)
Evaluates the field at given point.
SpatialLocalizer * giveSpatialLocalizer()
Definition: domain.C:1184
Wrapper around element definition to provide FEICellGeometry interface.
Definition: feinterpol.h:95
virtual int global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo)=0
Evaluates local coordinates from given global ones.
virtual Element * giveElementContainingPoint(const FloatArray &coords, const IntArray *regionList=NULL)=0
Returns the element, containing given point and belonging to one of the region in region list...
Class representing vector of real numbers.
Definition: floatarray.h:82
long ContextMode
Definition: contextmode.h:43
int giveSize() const