55 FEMComponent(n, aDomain), dofArray(), loadArray(), partitions()
104 if ( type != ExternalForcesVector ) {
125 if ( pos == this->
end() ) {
126 OOFEM_ERROR(
"dof with given DofID does not exists");
154 for (
Dof *dof: *
this ) {
168 for (
Dof *dof: *
this ) {
184 locationArray.
resize(size);
185 for (
int i = 1; i <= size; i++ ) {
187 if ( pos == this->
end() ) {
188 OOFEM_ERROR(
"incompatible dof (%d) requested", dofIDArry.
at(i));
195 locationArray.
clear();
197 for (
int dofid: dofIDArry ) {
199 if ( pos == this->
end() ) {
200 OOFEM_ERROR(
"incompatible dof (%d) requested", dofid);
202 (*pos)->giveEquationNumbers(mstrEqNmbrs, s);
212 masterDofIDs = dofIDArry;
215 masterDofIDs.
clear();
217 for (
int dofid: dofIDArry ) {
219 if ( pos == this->
end() ) {
220 OOFEM_ERROR(
"incompatible dof (%d) requested", dofid);
222 (*pos)->giveDofIDs(temp);
235 for (
Dof *dof: *
this ) {
241 for (
Dof *dof: *
this ) {
253 for (
Dof *dof: *
this ) {
258 for (
Dof *dof: *
this ) {
269 for (
Dof *dof: *
this ) {
271 return this->
begin() + i;
288 for (
Dof *dof: *
this ) {
291 this->
dofArray.assign(_ndofs, NULL);
297 for (
Dof *dof: *
this ) {
311 for (
int dofid: dofIDArray ) {
314 if ( pos == this->
end() ) {
315 OOFEM_ERROR(
"Dof with ID %d doesn't exist", dofid);
318 answer += (*pos)->giveNumberOfPrimaryMasterDofs();
342 IntArray ic, masterMask, dofTypeMask;
397 bool hasTypeinfo = dofTypeMask.
giveSize() != 0;
400 if ( ( hasIc || hasBc || hasTypeinfo ) && !this->
dofidmask ) {
409 this->
dofBCmap =
new std :: map< int, int >();
411 if (
mBC.
at(i) > 0 ) {
421 this->
dofICmap =
new std :: map< int, int >();
422 for (
int i = 1; i <= ic.
giveSize(); ++i ) {
423 if ( ic.
at(i) > 0 ) {
433 this->
dofTypemap =
new std :: map< int, int >();
434 for (
int i = 1; i <= dofTypeMask.
giveSize(); ++i ) {
435 if ( dofTypeMask.
at(i) != DT_master ) {
440 if ( dofTypeMask.
contains(DT_simpleSlave) ) {
446 for (
int i = 1; i <= masterMask.
giveSize(); ++i ) {
447 if ( masterMask.
at(i) > 0 ) {
466 for (
Dof *dof: *
this ) {
515 for (
Dof *dof: *
this ) {
524 printf(
"DofManager %d\n",
number);
525 for (
Dof *dof: *
this ) {
537 for (
Dof *dof: *
this ) {
557 if ( !stream.
write(this->giveNumberOfDofs()) ) {
561 for (
auto &dof : *
this ) {
562 _val = dof->giveDofType();
563 if ( !stream.
write(_val) ) {
566 _val = dof->giveDofID();
567 if ( !stream.
write(_val) ) {
570 if ( ( iores = dof->saveContext(stream, mode, obj) ) !=
CIO_OK ) {
592 if ( !stream.
write(_val) ) {
600 for (
auto &dof : *
this ) {
601 if ( ( iores = dof->saveContext(stream, mode, obj) ) !=
CIO_OK ) {
625 if ( !stream.
read(_numberOfDofs) ) {
630 for (
auto &d:
dofArray) {
delete d; }
633 for (
int i = 0; i < _numberOfDofs; i++ ) {
635 if ( !stream.
read(dtype) ) {
638 if ( !stream.
read(dofid) ) {
665 if ( !stream.
read(_val) ) {
674 for (
auto &dof : this->
dofArray ) {
675 if ( ( iores = dof->restoreContext(stream, mode, obj) ) !=
CIO_OK ) {
688 if ( dofIDArry.
giveSize() == 0 )
return;
691 for (
auto &dofid: dofIDArry ) {
693 if ( pos == this->
end() ) {
699 answer.
at(++k) = (*pos)->giveUnknown(mode, tStep);
717 for (
auto &dofid: dofIDArry ) {
719 if ( pos == this->
end() ) {
725 answer.
at(++k) = (*pos)->giveUnknown(field, mode, tStep);
741 for (
Dof *dof: *
this ) {
754 for (
int dofid: dofIDArry ) {
774 for (
Dof *d: *
this ) {
776 if ( ut == DisplacementVector || ut == EigenVector ) {
778 dofIDArry.
at(k) = D_u;
779 localVector.
at(k) = val;
782 dofIDArry.
at(k) = D_v;
783 localVector.
at(k) = val;
786 dofIDArry.
at(k) = D_w;
787 localVector.
at(k) = val;
790 }
else if ( ut == VelocityVector ) {
792 dofIDArry.
at(k) = V_u;
793 localVector.
at(k) = val;
796 dofIDArry.
at(k) = V_v;
797 localVector.
at(k) = val;
800 dofIDArry.
at(k) = V_w;
801 localVector.
at(k) = val;
805 OOFEM_ERROR(
"Can't produce vector for unknown type: %d", ut);
817 for (
int i = 1; i <= k; i++ ) {
818 if ( dofIDArry.
at(i) == D_u || dofIDArry.
at(i) == V_u ) {
819 answer.
at(1) = localVector.
at(i);
820 }
else if ( dofIDArry.
at(i) == D_v || dofIDArry.
at(i) == V_v ) {
821 answer.
at(2) = localVector.
at(i);
822 }
else if ( dofIDArry.
at(i) == D_w || dofIDArry.
at(i) == V_w ) {
823 answer.
at(3) = localVector.
at(i);
832 for (
Dof *dof: *
this ) {
848 for (
Dof *dof: *
this ) {
852 for (
int j = 1; j <= _dof_masters.
giveSize(); j++ ) {
865 for (
Dof *dof: *
this ) {
885 if ( !hasL2G && !hasM2L ) {
888 }
else if ( hasL2G && hasM2L ) {
890 }
else if ( hasL2G ) {
916 for (
Dof *dof: *
this ) {
923 for (
Dof *dof: *
this ) {
934 for (
int i = 1; i <= dofIDArry.
giveSize(); i++ ) {
935 this->
giveDofWithID(dofIDArry.
at(i))->computeDofTransformation(mstrContrs);
959 for (
Dof *dof: *
this ) {
969 for (
int i = 1; i <= size; i++ ) {
998 int minrank = myrank;
1000 for (
int j = 1; j <= n; j++ ) {
1004 if ( minrank == myrank ) {
bool contains(int value) const
#define _IFT_DofManager_nullflag
contextIOResultType storeYourself(DataStream &stream) const
Stores array to output stream.
int number
Component number.
DofManager in active domain is shared only by remote elements (these are only introduced for nonlocal...
void printYourself() const
Prints receiver on stdout.
#define _IFT_DofManager_mastermask
DofManager(int n, Domain *aDomain)
Constructor.
#define _IFT_DofManager_ic
Domain * domain
Link to domain object, useful for communicating with other FEM components.
virtual bool giveMasterDofMans(IntArray &masters)
Returns true if the receiver is linked (its slave DOFs depend on master values) to some other dof man...
virtual void computeLoadVector(FloatArray &answer, Load *load, CharType type, TimeStep *tStep, ValueModeType mode)
Computes the load vector for given load.
Abstract class representing field of primary variables (those, which are unknown and are typically as...
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
bool isEmpty() const
Checks if receiver is empty (i.e., zero sized).
double & at(int i)
Coefficient access function.
virtual void printYourself()
Prints receiver state on stdout. Useful for debugging.
virtual void postInitialize()
Performs post-initialization such like checking if there are any slave dofs etc.
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
virtual const IntArray & giveDofIDs() const
Array with default dofs which b.c.
#define _IFT_DofManager_boundaryflag
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
void clear()
Clears receiver (zero size).
std::map< int, int > * dofMastermap
Map from DofIDItem to master node.
bool insertSortedOnce(int value, int allocChunk=0)
Inserts given value into a receiver, which is assumed to be sorted.
virtual double giveUnknown(ValueModeType mode, TimeStep *tStep)=0
The key method of class Dof.
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
std::vector< Dof * > dofArray
Array of DOFs.
dofType
Dof Type, determines the type of DOF created.
const IntArray & giveDefaultNodeDofIDArry()
Returns default DofID array which defines physical meaning of particular DOFs.
#define _IFT_DofManager_dofidmask
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
virtual void printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *tStep)
DOF printing routine.
virtual void computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
Computes boundary condition value - its components values at given time.
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to stream, for given time step.
std::map< int, int > * dofICmap
Map from DofIDItem to ic (to be removed).
virtual void printYourself()
Prints the receiver state on stdout.
virtual bool hasAnySlaveDofs()
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
virtual void giveEquationNumbers(IntArray &masterEqNumbers, const UnknownNumberingScheme &s)
Returns equation number of receiver.
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
int givePartitionsConnectivitySize()
Returns number of partitions sharing given receiver (=number of shared partitions + local one)...
dofManagerParallelMode
In parallel mode, this type indicates the mode of DofManager.
void rotatedWith(FloatMatrix &r, char mode)
Returns the receiver a rotated according the change-of-base matrix r.
virtual int giveDofEquationNumber(Dof *dof) const =0
Returns the equation number for corresponding DOF.
#define _IFT_DofManager_bc
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
virtual void updateLocalNumbering(EntityRenumberingFunctor &f)
Local renumbering support.
void giveUnknownVector(FloatArray &answer, const IntArray &dofMask, ValueModeType mode, TimeStep *tStep, bool padding=false)
Assembles the vector of unknowns in global c.s for given dofs of receiver.
virtual int giveBcId()=0
Returns the id of associated boundary condition, if there is any.
#define _IFT_DofManager_remoteflag
bool hasSlaveDofs
Flag indicating whether receiver has slave DOFs.
bool computeM2GTransformation(FloatMatrix &answer, const IntArray &dofIDArry)
Computes receiver transformation matrix from global CS to dofManager specific coordinate system; ...
int giveNumberOfDofs() const
int globalNumber
In parallel mode, globalNumber contains globally unique DoFManager number.
void giveUnknownVectorOfType(FloatArray &answer, UnknownType ut, ValueModeType mode, TimeStep *tStep)
Constructs the requested vector by assembling e.g.
void insertOnce(int p)
Insert once (does not make any assumption about receiver state or ordering, quite inefficient)...
virtual bool requiresTransformation()
Indicates, whether dofManager requires the transformation.
void clear()
Clears the array (zero size).
DofIDItem
Type representing particular dof type.
void copySubVectorRow(const FloatArray &src, int sr, int sc)
Copy (set) given vector to receiver row sr, starting at column sc.
UnknownType
Type representing particular unknown (its physical meaning).
void giveMasterDofIDArray(const IntArray &dofIDArry, IntArray &masterDofIDs) const
Returns master dof ID array of receiver.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
DofIDItem giveDofID() const
Returns DofID value of receiver, which determines type of of unknown connected to receiver (e...
void setLoadArray(IntArray &load)
Sets the array of applied loadings of the receiver.
virtual bool isPrimaryDof()
Tests if receiver is primary DOF.
virtual void giveMasterDofManArray(IntArray &answer)
IntArray partitions
List of partition sharing the shared dof manager or remote partition containing remote dofmanager cou...
void resizeWithValues(int n, int allocChunk=0)
Checks size of receiver towards requested bounds.
#define _IFT_DofManager_doftypemask
void askNewEquationNumbers(TimeStep *tStep)
Renumbers all contained DOFs.
void giveCompleteMasterDofIDArray(IntArray &dofIDArray) const
Returns the full dof ID array of receiver.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
void resizeWithValues(int s, int allocChunk=0)
Checks size of receiver towards requested bounds.
void resize(int n)
Checks size of receiver towards requested bounds.
void giveCompleteUnknownVector(FloatArray &answer, ValueModeType mode, TimeStep *tStep)
Assembles the complete unknown vector in node.
contextIOResultType restoreYourself(DataStream &stream)
Restores array from image on stream.
IntArray loadArray
List of applied loads.
void appendDof(Dof *dof)
Adds the given Dof into the receiver.
virtual bool computeL2GTransformation(FloatMatrix &answer, const IntArray &dofIDArry)
Computes transformation matrix from global c.s.
Class representing vector of real numbers.
void setNumberOfDofs(int _ndofs)
Sets number of dofs of the receiver; Deallocates existing DOFs; Resizes the dofArray accordingly...
Dof * createDof(dofType type, DofIDItem dofid, DofManager *dman)
Creates new instance of DOF corresponding to given keyword.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
bool hasDofID(DofIDItem id) const
Checks if receiver contains dof with given ID.
dofManagerParallelMode parallel_mode
Implementation of matrix containing floating point numbers.
IRResultType
Type defining the return values of InputRecord reading operations.
void givePrescribedUnknownVector(FloatArray &answer, const IntArray &dofMask, ValueModeType mode, TimeStep *tStep)
Assembles the vector of prescribed unknowns in nodal c.s for given dofs of receiver.
virtual const char * giveClassName() const =0
void giveCompleteLocationArray(IntArray &locationArray, const UnknownNumberingScheme &s) const
Returns full location array of receiver containing equation numbers of all dofs of receiver...
void assemble(const FloatArray &fe, const IntArray &loc)
Assembles the array fe (typically, the load vector of a finite element) into the receiver, using loc as location array.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
std::vector< Dof * >::const_iterator findDofWithDofId(DofIDItem dofID) const
Finds index of DOF with required physical meaning of receiver.
bool isBoundaryFlag
Indicates if dofManager is boundary (true boundary or on boundary between regions) or interior...
std::vector< Dof * >::iterator begin()
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
void mergePartitionList(IntArray &_p)
Merges receiver partition list with given lists.
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
std::map< int, int > * dofBCmap
Map from DofIDItem to bc (to be removed).
virtual double giveBcValue(ValueModeType mode, TimeStep *tStep)
Returns value of boundary condition of dof if it is prescribed.
void zero()
Zeroes all coefficients of receiver.
virtual bcGeomType giveBCGeoType() const
Returns geometry character of boundary condition.
int giveRank() const
Returns domain rank in a group of collaborating processes (0..groupSize-1)
std::map< int, int > * dofTypemap
Map from DofIDItem to dofType.
virtual void computeDofTransformation(FloatArray &masterContribs)
Computes dof transformation array, which describes the dependence of receiver value on values of mast...
ClassFactory & classFactory
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
IntArray * giveLoadArray()
Returns the array containing applied loadings of the receiver.
void zero()
Zeroes all coefficient of receiver.
Domain * giveDomain() const
int min(int i, int j)
Returns smaller value from two given decimals.
#define _IFT_DofManager_sharedflag
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Load is base abstract class for all loads.
Abstract base class representing the "problem" under consideration.
virtual int giveNumberOfPrimaryMasterDofs()
DofManager in active domain is only mirror of some remote DofManager.
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
virtual void updateYourself(TimeStep *tStep)
Updates receiver after finishing time step.
int giveSize() const
Returns the size of receiver.
virtual ~DofManager()
Destructor.
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumberOfPrimaryMasterDofs(const IntArray &dofIDArray) const
Returns the number of primary dofs on which receiver dofs (given in dofArray) depend on...
std::vector< Dof * >::iterator end()
void clear()
Sets size of receiver to be an empty matrix. It will have zero rows and zero columns size...
bool isLocal()
Returns true if receiver is locally maintained.
#define _IFT_DofManager_load
Abstract class Dof represents Degree Of Freedom in finite element mesh.
virtual void giveDofIDs(IntArray &masterDofIDs)
As giveEquationNumbers but for dof IDs.
void giveLocationArray(const IntArray &dofIDArry, IntArray &locationArray, const UnknownNumberingScheme &s) const
Returns location array (array containing for each requested dof related equation number) for given nu...
DofManager is local, there are no contribution from other domains to this DofManager.
virtual void updateYourself(TimeStep *tStep)
Updates receiver after equilibrium in time step has been reached.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
void removeDof(DofIDItem id)
Removes Dof with given id from dofArray.
#define OOFEM_WARNING(...)
#define _IFT_DofManager_partitions
Class representing solution step.
The top abstract class of all classes constituting the finite element mesh.
DofManager is shared by neighboring partitions, it is necessary to sum contributions from all contrib...
virtual int askNewEquationNumber(TimeStep *tStep)=0
Asks EngngModel for new equation number.
virtual void updateLocalNumbering(EntityRenumberingFunctor &f)
Local renumbering support.
int findFirstIndexOf(int value) const
Finds index of first occurrence of given value in array.
IntArray * dofidmask
List of additional dof ids to include.
virtual bool computeM2LTransformation(FloatMatrix &answer, const IntArray &dofIDArry)
Computes transformation matrix from local DOFs to master DOFs; .
void resize(int s)
Resizes receiver towards requested size.