OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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
43namespace oofem {
44SmoothedNodalInternalVariableField :: SmoothedNodalInternalVariableField(InternalStateType ist, FieldType ft, NodalRecoveryModel :: NodalRecoveryModelType st, Domain *d) : Field(ft), elemSet(0, d)
45{
46 this->istType = ist;
47 this->stype = st;
48 this->smoother = classFactory.createNodalRecoveryModel(this->stype, d);
49 this->domain = d;
50 elemSet.addAllElements();
51}
52
53SmoothedNodalInternalVariableField :: ~SmoothedNodalInternalVariableField() { }
54
55int
56SmoothedNodalInternalVariableField :: evaluateAt(FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep)
57{
58 int result = 0; // assume ok
59 FloatArray lc, n;
60 const FloatArray *nodalValue;
61
62 this->smoother->recoverValues(elemSet, istType, tStep);
63 // request element containing target point
64 Element *elem = this->domain->giveSpatialLocalizer()->giveElementContainingPoint(coords);
65 if ( elem ) { // ok element containing target point found
66 FEInterpolation *interp = elem->giveInterpolation();
67 if ( interp ) {
68 // map target point to element local coordinates
69 if ( interp->global2local( lc, coords, FEIElementGeometryWrapper(elem) ) ) {
70 // evaluate interpolation functions at target point
71 interp->evalN( n, lc, FEIElementGeometryWrapper(elem) );
72 // loop over element nodes
73 for ( int i = 1; i <= n.giveSize(); i++ ) {
74 // request nodal value
75 this->smoother->giveNodalVector( nodalValue, elem->giveDofManagerNumber(i) );
76 // multiply nodal value by value of corresponding shape function and add this to answer
77 answer.add(n.at(i), * nodalValue);
78 }
79 } else { // mapping from global to local coordinates failed
80 result = 1; // failed
81 }
82 } else { // element without interpolation
83 result = 1; // failed
84 }
85 } else { // no element containing given point found
86 result = 1; // failed
87 }
88 return result;
89}
90
91int
92SmoothedNodalInternalVariableField :: evaluateAt(FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep)
93{
94 const FloatArray *val;
95
96 this->smoother->recoverValues(elemSet, istType, tStep);
97
98 int result = this->smoother->giveNodalVector( val, dman->giveNumber() );
99 answer = * val;
100 return ( result == 1 );
101}
102
103void
104SmoothedNodalInternalVariableField :: saveContext(DataStream &stream)
105{
106}
107
108void
109SmoothedNodalInternalVariableField :: restoreContext(DataStream &stream)
110{
111}
112} // end namespace oofem
virtual FEInterpolation * giveInterpolation() const
Definition element.h:648
int giveDofManagerNumber(int i) const
Definition element.h:609
virtual int global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo) const =0
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
int giveNumber() const
Definition femcmpnn.h:104
Field(FieldType b=FieldType::FT_Unknown)
Definition field.h:95
double & at(Index i)
Definition floatarray.h:202
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void add(const FloatArray &src)
Definition floatarray.C:218
NodalRecoveryModel::NodalRecoveryModelType stype
Smoother type.
std::unique_ptr< NodalRecoveryModel > smoother
Smoother.
InternalStateType istType
InternalStateType.
FieldType
Physical type of field.
Definition field.h:64
ClassFactory & classFactory

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011