OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
eleminterpunknownmapper.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 "element.h"
37 #include "domain.h"
38 #include "engngm.h"
39 #include "spatiallocalizer.h"
40 #include "node.h"
41 #include "dof.h"
42 #include "connectivitytable.h"
43 #include "unknownnumberingscheme.h"
44 
45 namespace oofem {
47 { }
48 
49 #define OOFEM_MAPPING_CHECK_REGIONS
50 
51 int
53  Domain *oldd, Domain *newd, TimeStep *tStep)
54 {
55  int inode, nd_nnodes = newd->giveNumberOfDofManagers();
57  FloatArray unknownValues;
58  IntArray dofidMask;
59  IntArray reglist;
60 #ifdef OOFEM_MAPPING_CHECK_REGIONS
61  ConnectivityTable *conTable = newd->giveConnectivityTable();
62  const IntArray *nodeConnectivity;
63 #endif
64 
65  answer.resize(nsize);
66  answer.zero();
67 
68  for ( inode = 1; inode <= nd_nnodes; inode++ ) {
69  DofManager *node = newd->giveNode(inode);
70  /* Process local and shared nodes only */
71  if ( (node->giveParallelMode() != DofManager_local ) &&
72  (node->giveParallelMode() != DofManager_shared)) {
73  continue;
74  }
75 
76 #ifdef OOFEM_MAPPING_CHECK_REGIONS
77  // build up region list for node
78  nodeConnectivity = conTable->giveDofManConnectivityArray(inode);
79  reglist.resize( nodeConnectivity->giveSize() );
80  reglist.clear();
81  for ( int indx = 1; indx <= nodeConnectivity->giveSize(); indx++ ) {
82  reglist.insertSortedOnce( newd->giveElement( nodeConnectivity->at(indx) )->giveRegionNumber() );
83  }
84 
85 #endif
86  if ( this->evaluateAt(unknownValues, dofidMask, mode, oldd, * node->giveCoordinates(), reglist, tStep) ) {
89  for ( int ii = 1; ii <= dofidMask.giveSize(); ii++ ) {
90  // exclude slaves; they are determined from masters
91  auto it = node->findDofWithDofId((DofIDItem)dofidMask.at(ii));
92  if ( it != node->end() ) {
93  Dof *dof = *it;
94  if ( dof->isPrimaryDof() ) {
96  if (eq)
97  answer.at( eq ) += unknownValues.at(ii);
98  }
99  }
100  }
101  } else {
102  OOFEM_ERROR("evaluateAt service failed for node %d", inode);
103  }
104  }
105 
106  return 1;
107 }
108 
109 
110 int
112  Domain *oldd, FloatArray &coords, IntArray &regList, TimeStep *tStep)
113 {
114  Element *oelem;
116 
117  FloatArray lcoords, closest;
118  if ( regList.isEmpty() ) {
119  oelem = sl->giveElementClosestToPoint(lcoords, closest, coords, 0);
120  } else {
121  // Take the minimum of any region
122  double mindist = 0.0, distance;
123  oelem = NULL;
124  for ( int i = 1; i <= regList.giveSize(); ++i ) {
125  Element *tmpelem = sl->giveElementClosestToPoint( lcoords, closest, coords, regList.at(i) );
126  if ( tmpelem != NULL ) {
127  distance = closest.distance_square(coords);
128  if ( distance < mindist || i == 1 ) {
129  mindist = distance;
130  oelem = tmpelem;
131  if ( distance == 0.0 ) {
132  break;
133  }
134  }
135  }
136  }
137  }
138  if ( !oelem ) {
139  OOFEM_WARNING("Couldn't find any element containing point.");
140  return false;
141  }
142 
143  oelem->giveElementDofIDMask(dofMask);
144  oelem->computeField(mode, tStep, lcoords, answer);
145 
146  return true;
147 }
148 } // end namespace oofem
The base class for all spatial localizers.
The representation of EngngModel default unknown numbering.
Class and object Domain.
Definition: domain.h:115
virtual int giveNumberOfDomainEquations(int di, const UnknownNumberingScheme &num)
Returns number of equations for given domain in active (current time step) time step.
Definition: engngm.C:391
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
bool isEmpty() const
Checks if receiver is empty (i.e., zero sized).
Definition: intarray.h:208
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
ConnectivityTable * giveConnectivityTable()
Returns receiver&#39;s associated connectivity table.
Definition: domain.C:1170
bool insertSortedOnce(int value, int allocChunk=0)
Inserts given value into a receiver, which is assumed to be sorted.
Definition: intarray.C:360
virtual int evaluateAt(FloatArray &answer, IntArray &dofMask, ValueModeType mode, Domain *oldd, FloatArray &coords, IntArray &regList, TimeStep *tStep)
Evaluates the vector of primary unknowns, determined by domain, at given point.
virtual FloatArray * giveCoordinates()
Definition: dofmanager.h:382
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Definition: domain.C:433
Abstract base class for all finite elements.
Definition: element.h:145
Base class for dof managers.
Definition: dofmanager.h:113
int giveNumber()
Returns domain number.
Definition: domain.h:266
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
Element * giveElement(int n)
Service for accessing particular domain fe element.
Definition: domain.C:160
#define OOFEM_ERROR(...)
Definition: error.h:61
void clear()
Clears the array (zero size).
Definition: intarray.h:177
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
SpatialLocalizer * giveSpatialLocalizer()
Returns receiver&#39;s associated spatial localizer.
Definition: domain.C:1184
virtual bool isPrimaryDof()
Tests if receiver is primary DOF.
Definition: dof.h:287
Class representing connectivity table.
virtual void giveElementDofIDMask(IntArray &answer) const
Returns element dof mask for node.
Definition: element.h:498
double distance_square(const FloatArray &iP1, const FloatArray &iP2, double &oXi, double &oXiUnbounded) const
Definition: floatarray.C:499
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
The base class for all primary unknowns mappers.
Class representing vector of real numbers.
Definition: floatarray.h:82
const IntArray * giveDofManConnectivityArray(int dofman)
virtual Element * giveElementClosestToPoint(FloatArray &lcoords, FloatArray &closest, const FloatArray &coords, int region=0)=0
Returns the element closest to a given point.
std::vector< Dof * >::const_iterator findDofWithDofId(DofIDItem dofID) const
Finds index of DOF with required physical meaning of receiver.
Definition: dofmanager.C:266
virtual int mapAndUpdate(FloatArray &answer, ValueModeType mode, Domain *oldd, Domain *newd, TimeStep *tStep)
Maps and updates the vector(s) of primary unknowns from old mesh oldd to new mesh newd...
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
int giveEquationNumber(const UnknownNumberingScheme &s)
Returns equation number of receiver for given equation numbering scheme.
Definition: dof.C:56
int giveSize() const
Definition: intarray.h:203
virtual void computeField(ValueModeType mode, TimeStep *tStep, const FloatArray &lcoords, FloatArray &answer)
Computes the unknown vector interpolated at the specified local coordinates.
Definition: element.h:508
Node * giveNode(int n)
Service for accessing particular domain node.
Definition: domain.h:371
the oofem namespace is to define a context or scope in which all oofem names are defined.
std::vector< Dof * >::iterator end()
Definition: dofmanager.h:158
Abstract class Dof represents Degree Of Freedom in finite element mesh.
Definition: dof.h:93
DofManager is local, there are no contribution from other domains to this DofManager.
Definition: dofmanager.h:81
#define OOFEM_WARNING(...)
Definition: error.h:62
Class representing solution step.
Definition: timestep.h:80
DofManager is shared by neighboring partitions, it is necessary to sum contributions from all contrib...
Definition: dofmanager.h:82
dofManagerParallelMode giveParallelMode() const
Return dofManagerParallelMode of receiver.
Definition: dofmanager.h:512
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

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