OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
dofmanager.h
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 #ifndef dofmanager_h
36 #define dofmanager_h
37 
38 #include <cstdio>
39 #include <map>
40 
41 #include "femcmpnn.h"
42 #include "intarray.h"
43 #include "valuemodetype.h"
44 #include "doftype.h"
45 #include "dofiditem.h"
46 #include "contextioresulttype.h"
47 #include "unknowntype.h"
48 #include "chartype.h"
49 
51 
52 #define _IFT_DofManager_dofidmask "dofidmask"
53 #define _IFT_DofManager_load "load"
54 #define _IFT_DofManager_bc "bc"
55 #define _IFT_DofManager_ic "ic"
56 #define _IFT_DofManager_mastermask "mastermask"
57 #define _IFT_DofManager_doftypemask "doftype"
58 #define _IFT_DofManager_boundaryflag "boundary"
59 #define _IFT_DofManager_globnum "globnum"
60 #define _IFT_DofManager_partitions "partitions"
61 #define _IFT_DofManager_sharedflag "shared"
62 #define _IFT_DofManager_remoteflag "remote"
63 #define _IFT_DofManager_nullflag "null"
64 
65 
66 namespace oofem {
67 class DataStream;
68 class Dof;
69 class Domain;
70 class EntityRenumberingFunctor;
71 class FloatMatrix;
72 class PrimaryField;
73 class UnknownNumberingScheme;
74 class Load;
75 class TimeStep;
76 class FloatArray;
77 class IntArray;
78 
93 };
94 
113 class OOFEM_EXPORT DofManager : public FEMComponent
114 {
115 protected:
117  std::vector< Dof * > dofArray;
133 
135 
141 
145  std :: map< int, int > *dofTypemap;
147  std :: map< int, int > *dofMastermap;
149  std :: map< int, int > *dofBCmap;
151  std :: map< int, int > *dofICmap;
152 
153  // List of BCs (to enable writing to DynamicInputRecord)
155 
156 public:
157  std::vector< Dof* > :: iterator begin() { return dofArray.begin(); }
158  std::vector< Dof* > :: iterator end() { return dofArray.end(); }
159  std::vector< Dof* > :: const_iterator begin() const { return dofArray.begin(); }
160  std::vector< Dof* > :: const_iterator end() const { return dofArray.end(); }
161 
167  DofManager(int n, Domain * aDomain);
169  virtual ~DofManager();
170 
179  Dof *giveDofWithID(int dofID) const;
181  int giveNumberOfDofs() const;
182 
184  void askNewEquationNumbers(TimeStep *tStep);
191  int giveNumberOfPrimaryMasterDofs(const IntArray &dofIDArray) const;
203  void giveLocationArray(const IntArray &dofIDArry, IntArray &locationArray,
204  const UnknownNumberingScheme &s) const;
213  void giveMasterDofIDArray(const IntArray &dofIDArry, IntArray &masterDofIDs) const;
221  void giveCompleteLocationArray(IntArray &locationArray, const UnknownNumberingScheme &s) const;
227  void giveCompleteMasterDofIDArray(IntArray &dofIDArray) const;
234  std :: vector< Dof* > :: const_iterator findDofWithDofId(DofIDItem dofID) const;
249  void giveUnknownVector(FloatArray &answer, const IntArray &dofMask, ValueModeType mode, TimeStep *tStep, bool padding = false);
265  void giveUnknownVector(FloatArray &answer, const IntArray &dofMask,
266  PrimaryField &field, ValueModeType mode, TimeStep *tStep, bool padding = false);
273  void giveCompleteUnknownVector(FloatArray &answer, ValueModeType mode, TimeStep *tStep);
283  void giveUnknownVectorOfType(FloatArray &answer, UnknownType ut, ValueModeType mode, TimeStep *tStep);
302  void givePrescribedUnknownVector(FloatArray &answer, const IntArray &dofMask,
303  ValueModeType mode, TimeStep *tStep);
305 
329  bool computeM2GTransformation(FloatMatrix &answer, const IntArray &dofIDArry);
337  virtual bool computeL2GTransformation(FloatMatrix &answer, const IntArray &dofIDArry);
345  virtual bool computeM2LTransformation(FloatMatrix &answer, const IntArray &dofIDArry);
350  virtual bool requiresTransformation();
352 
363  virtual void computeLoadVector(FloatArray &answer, Load *load, CharType type, TimeStep *tStep, ValueModeType mode);
368  IntArray *giveLoadArray();
373  void setLoadArray(IntArray &load);
375 
378  virtual bool hasCoordinates() { return false; }
380  virtual double giveCoordinate(int i) { return 0.0; }
382  virtual FloatArray *giveCoordinates() { return NULL; }
384 
391  const IntArray *giveForcedDofIDs() { return dofidmask; }
396  std :: map< int, int > *giveDofTypeMap() { return dofTypemap; }
402  std :: map< int, int > *giveMasterMap() { return dofMastermap; }
408  std :: map< int, int > *giveBcMap() { return dofBCmap; }
414  std :: map< int, int > *giveIcMap() { return dofICmap; }
416 
417  virtual void printOutputAt(FILE *file, TimeStep *tStep);
422  virtual void updateYourself(TimeStep *tStep);
423 
424  // Miscellaneous
426  bool isBoundary() { return isBoundaryFlag; }
431  void setBoundaryFlag(bool isBoundary) { this->isBoundaryFlag = isBoundary; }
433  virtual bool hasAnySlaveDofs();
441  virtual bool giveMasterDofMans(IntArray &masters);
442 
443  virtual IRResultType initializeFrom(InputRecord *ir);
444  virtual void giveInputRecord(DynamicInputRecord &input);
445 
446  virtual void printYourself();
447  virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj = NULL);
448  virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj = NULL);
449 
451  virtual bool isDofTypeCompatible(dofType type) const { return false; }
455  virtual void postInitialize();
463  virtual void updateLocalNumbering(EntityRenumberingFunctor &f);
464 
471  void setNumberOfDofs(int _ndofs);
473 
480  void appendDof(Dof *dof);
481 
486  void removeDof(DofIDItem id);
487 
494  bool hasDofID(DofIDItem id) const;
495 
496 #ifdef __OOFEG
497  virtual void drawYourself(oofegGraphicContext &gc, TimeStep *tStep) { }
498 #endif
499 
501  int giveGlobalNumber() const { return globalNumber; }
502  int giveLabel() const { return globalNumber; }
507  void setGlobalNumber(int newNumber) { globalNumber = newNumber; }
508 
512  dofManagerParallelMode giveParallelMode() const { return parallel_mode; }
514  void setParallelMode(dofManagerParallelMode _mode) { parallel_mode = _mode; }
519  const IntArray *givePartitionList() { return & partitions; }
521  void setPartitionList(const IntArray *_p) { partitions = * _p; }
523  void removePartitionFromList(int _part) {
524  int _pos = partitions.findFirstIndexOf(_part);
525  if ( _pos ) {
526  partitions.erase(_pos);
527  }
528  }
530  void mergePartitionList(IntArray &_p);
534  int givePartitionsConnectivitySize();
536  bool isLocal();
538  bool isShared() { return parallel_mode == DofManager_shared; }
540  bool isNull() { return parallel_mode == DofManager_null; }
541 };
542 } // end namespace oofem
543 #endif // dofmanager_h
std::map< int, int > * giveMasterMap()
Returns map from DofIDItem to dofType.
Definition: dofmanager.h:402
DofManager in active domain is shared only by remote elements (these are only introduced for nonlocal...
Definition: dofmanager.h:88
void erase(int pos)
Erase the element at given position (1-based index) Receiver will shrink accordingly, the values at positions (pos+1,...,size) will be moved to positions (pos,...,size-1)
Definition: intarray.C:163
Class and object Domain.
Definition: domain.h:115
int giveGlobalNumber() const
Definition: dofmanager.h:501
std::map< int, int > * giveBcMap()
Returns map from DofIDItem to dofType.
Definition: dofmanager.h:408
Abstract class representing field of primary variables (those, which are unknown and are typically as...
Definition: primaryfield.h:104
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
void setBoundaryFlag(bool isBoundary)
Sets the boundary flag.
Definition: dofmanager.h:431
std::map< int, int > * dofMastermap
Map from DofIDItem to master node.
Definition: dofmanager.h:147
const IntArray * givePartitionList()
Returns partition list of receiver.
Definition: dofmanager.h:519
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual FloatArray * giveCoordinates()
Definition: dofmanager.h:382
std::vector< Dof * > dofArray
Array of DOFs.
Definition: dofmanager.h:117
dofType
Dof Type, determines the type of DOF created.
Definition: doftype.h:48
virtual bool isDofTypeCompatible(dofType type) const
Returns true if dof of given type is allowed to be associated to receiver.
Definition: dofmanager.h:451
Base class for dof managers.
Definition: dofmanager.h:113
std::map< int, int > * dofICmap
Map from DofIDItem to ic (to be removed).
Definition: dofmanager.h:151
Class implementing an array of integers.
Definition: intarray.h:61
virtual bool hasCoordinates()
Definition: dofmanager.h:378
void setParallelMode(dofManagerParallelMode _mode)
Sets parallel mode of receiver.
Definition: dofmanager.h:514
dofManagerParallelMode
In parallel mode, this type indicates the mode of DofManager.
Definition: dofmanager.h:80
std::map< int, int > * giveDofTypeMap()
Returns map from DofIDItem to dofType.
Definition: dofmanager.h:396
bool hasSlaveDofs
Flag indicating whether receiver has slave DOFs.
Definition: dofmanager.h:126
int globalNumber
In parallel mode, globalNumber contains globally unique DoFManager number.
Definition: dofmanager.h:132
int giveLabel() const
Definition: dofmanager.h:502
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
UnknownType
Type representing particular unknown (its physical meaning).
Definition: unknowntype.h:55
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
IntArray partitions
List of partition sharing the shared dof manager or remote partition containing remote dofmanager cou...
Definition: dofmanager.h:140
IntArray loadArray
List of applied loads.
Definition: dofmanager.h:119
Class representing vector of real numbers.
Definition: floatarray.h:82
void setPartitionList(const IntArray *_p)
Sets receiver&#39;s partition list.
Definition: dofmanager.h:521
bool isNull()
Returns true if receiver is shared.
Definition: dofmanager.h:540
void removePartitionFromList(int _part)
Removes given partition from receiver list.
Definition: dofmanager.h:523
dofManagerParallelMode parallel_mode
Definition: dofmanager.h:134
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
std::vector< Dof * >::const_iterator end() const
Definition: dofmanager.h:160
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
std::vector< Dof * >::const_iterator begin() const
Definition: dofmanager.h:159
virtual void drawYourself(oofegGraphicContext &gc, TimeStep *tStep)
Definition: dofmanager.h:497
CharType
Definition: chartype.h:87
Class representing the general Input Record.
Definition: inputrecord.h:101
bool isBoundaryFlag
Indicates if dofManager is boundary (true boundary or on boundary between regions) or interior...
Definition: dofmanager.h:124
std::vector< Dof * >::iterator begin()
Definition: dofmanager.h:157
std::map< int, int > * dofBCmap
Map from DofIDItem to bc (to be removed).
Definition: dofmanager.h:149
std::map< int, int > * dofTypemap
Map from DofIDItem to dofType.
Definition: dofmanager.h:145
Class representing the a dynamic Input Record.
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
Load is base abstract class for all loads.
Definition: load.h:61
DofManager in active domain is only mirror of some remote DofManager.
Definition: dofmanager.h:85
const IntArray * giveForcedDofIDs()
Returns list of specific dofs that should be included in node.
Definition: dofmanager.h:391
virtual double giveCoordinate(int i)
Definition: dofmanager.h:380
std::map< int, int > * giveIcMap()
Returns map from DofIDItem to initial condition.
Definition: dofmanager.h:414
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
bool isShared()
Returns true if receiver is shared.
Definition: dofmanager.h:538
DofManager is local, there are no contribution from other domains to this DofManager.
Definition: dofmanager.h:81
void setGlobalNumber(int newNumber)
Sets receiver global number.
Definition: dofmanager.h:507
Class representing solution step.
Definition: timestep.h:80
The top abstract class of all classes constituting the finite element mesh.
Definition: femcmpnn.h:76
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
int findFirstIndexOf(int value) const
Finds index of first occurrence of given value in array.
Definition: intarray.C:331
IntArray * dofidmask
List of additional dof ids to include.
Definition: dofmanager.h:143

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