OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
smoothednodalintvarfield.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 
36 #include "spatiallocalizer.h"
37 #include "classfactory.h"
38 #include "element.h"
39 #include "feinterpol.h"
40 #include "dofmanager.h"
41 #include "set.h"
42 
43 namespace oofem {
45 {
46  this->istType = ist;
47  this->stype = st;
49  this->domain = d;
50 }
51 
53 {
54  if ( smoother ) {
55  delete smoother;
56  }
57 }
58 
59 int
61 {
62  int result = 0; // assume ok
63  FloatArray lc, n;
64  const FloatArray *nodalValue;
65 
66  // use whole domain recovery
67  // create a new set containing all elements
68  Set elemSet(0, this->domain);
69  elemSet.addAllElements();
70  this->smoother->recoverValues(elemSet, istType, tStep);
71  // request element containing target point
73  if ( elem ) { // ok element containing target point found
74  FEInterpolation *interp = elem->giveInterpolation();
75  if ( interp ) {
76  // map target point to element local coordinates
77  if ( interp->global2local( lc, coords, FEIElementGeometryWrapper(elem) ) ) {
78  // evaluate interpolation functions at target point
79  interp->evalN( n, lc, FEIElementGeometryWrapper(elem) );
80  // loop over element nodes
81  for ( int i = 1; i <= n.giveSize(); i++ ) {
82  // request nodal value
83  this->smoother->giveNodalVector( nodalValue, elem->giveDofManagerNumber(i) );
84  // multiply nodal value by value of corresponding shape function and add this to answer
85  answer.add(n.at(i), * nodalValue);
86  }
87  } else { // mapping from global to local coordinates failed
88  result = 1; // failed
89  }
90  } else { // element without interpolation
91  result = 1; // failed
92  }
93  } else { // no element containing given point found
94  result = 1; // failed
95  }
96  return result;
97 }
98 
99 int
101 {
102  if ( dman->hasCoordinates() ) {
103  const FloatArray *val;
104  int result = this->smoother->giveNodalVector( val, dman->giveNumber() );
105  answer = * val;
106  return ( result == 1 );
107  } else {
108  return 1; // failed -> dman without coordinates
109  }
110 }
111 
114 {
115  return CIO_OK;
116 }
117 
120 {
121  return CIO_OK;
122 }
123 } // end namespace oofem
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
NodalRecoveryModel * createNodalRecoveryModel(NodalRecoveryModel::NodalRecoveryModelType type, Domain *d)
Creates new instance of nodal recovery model corresponding to given type.
Definition: classfactory.C:153
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
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
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
Abstract base class for all finite elements.
Definition: element.h:145
Base class for dof managers.
Definition: dofmanager.h:113
virtual int evaluateAt(FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep)
Evaluates the field at given point.
virtual bool hasCoordinates()
Definition: dofmanager.h:378
virtual FEInterpolation * giveInterpolation() const
Definition: element.h:629
Abstract class representing field.
Definition: field.h:80
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
NodalRecoveryModel::NodalRecoveryModelType stype
Smoother type.
int giveNodalVector(const FloatArray *&ptr, int node)
Returns vector of recovered values for given node and region.
InternalStateType istType
InternalStateType.
Set of elements, boundaries, edges and/or nodes.
Definition: set.h:66
SpatialLocalizer * giveSpatialLocalizer()
Returns receiver&#39;s associated spatial localizer.
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
SmoothedNodalInternalVariableField(InternalStateType ist, FieldType b, NodalRecoveryModel::NodalRecoveryModelType st, Domain *d)
Constructor.
virtual int recoverValues(Set elementSet, InternalStateType type, TimeStep *tStep)=0
Recovers the nodal values for all regions.
void addAllElements()
Initialize the element set to contain all elements in the receiver domain.
Definition: set.C:212
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores receiver state to output stream.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode)
Restores the receiver state previously written in stream.
ClassFactory & classFactory
Definition: classfactory.C:59
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumber() const
Definition: femcmpnn.h:107
Class representing solution step.
Definition: timestep.h:80
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156

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