71DofManager :: DofManager(
int n,
Domain *aDomain) :
82DofManager :: ~DofManager()
112 if ( type != ExternalForcesVector ) {
127Dof *DofManager :: giveDofWithID(
int dofID)
const
133 if ( pos == this->
end() ) {
134 OOFEM_ERROR(
"dof with given DofID does not exists");
142void DofManager :: appendDof(
Dof *dof)
162 for (
Dof *dof: *
this ) {
176 for (
Dof *dof: *
this ) {
192 locationArray.
resize(size);
193 for (
int i = 1; i <= size; i++ ) {
195 if ( pos == this->
end() ) {
196 OOFEM_ERROR(
"incompatible dof (%d) requested", dofIDArry.
at(i));
203 locationArray.
clear();
205 for (
int dofid: dofIDArry ) {
207 if ( pos == this->
end() ) {
208 OOFEM_ERROR(
"incompatible dof (%d) requested", dofid);
210 (*pos)->giveEquationNumbers(mstrEqNmbrs, s);
217void DofManager :: giveMasterDofIDArray(
const IntArray &dofIDArry,
IntArray &masterDofIDs)
const
220 masterDofIDs = dofIDArry;
223 masterDofIDs.
clear();
225 for (
int dofid: dofIDArry ) {
227 if ( pos == this->
end() ) {
228 OOFEM_ERROR(
"incompatible dof (%d) requested", dofid);
230 (*pos)->giveDofIDs(temp);
243 for (
Dof *dof: *
this ) {
249 for (
Dof *dof: *
this ) {
257void DofManager :: giveCompleteMasterDofIDArray(
IntArray &dofIDArray)
const
261 for (
Dof *dof: *
this ) {
266 for (
Dof *dof: *
this ) {
274std :: vector< Dof* > :: const_iterator DofManager :: findDofWithDofId(
DofIDItem dofID)
const
277 for (
Dof *dof: *
this ) {
279 return this->
begin() + i;
287int DofManager :: giveNumberOfDofs() const
294void DofManager :: setNumberOfDofs(
int _ndofs)
296 for (
Dof *dof: *
this ) {
299 this->
dofArray.assign(_ndofs, NULL);
303void DofManager :: askNewEquationNumbers(
TimeStep *tStep)
305 for (
Dof *dof: *
this ) {
311int DofManager :: giveNumberOfPrimaryMasterDofs(
const IntArray &dofIDArray)
const
319 for (
int dofid: dofIDArray ) {
322 if ( pos == this->
end() ) {
323 OOFEM_ERROR(
"Dof with ID %d doesn't exist", dofid);
326 answer += (*pos)->giveNumberOfPrimaryMasterDofs();
336 bool boundaryFlag, sharedFlag, remoteFlag, nullFlag;
345 if ( boundaryFlag ) {
354 }
else if ( remoteFlag ) {
356 }
else if ( nullFlag ) {
367void DofManager :: initializeFinish()
375 dofIDArry =
domain->giveDefaultNodeDofIDArry();
378 bool hasBc, hasIc, hasTypeinfo;
383 if ((hasIc || hasBc || hasTypeinfo) &&
dofidmask.isEmpty()) {
392 for (
int i = 1; i <=
mBC.giveSize(); ++i ) {
393 if (
mBC.at(i) > 0 ) {
401 IntArray ic (std::get<IntArray>(*val));
406 for (
int i = 1; i <= ic.
giveSize(); ++i ) {
407 if ( ic.
at(i) > 0 ) {
415 IntArray dofTypeMask (std::get<IntArray>(*val));
421 for (
int i = 1; i <=
dofidmask.giveSize(); ++i ) {
422 if ( dofTypeMask.
at(i) != DT_master ) {
427 if ( dofTypeMask.
contains(DT_simpleSlave) ) {
430 IntArray masterMask (std::get<IntArray>(*val));
435 for (
int i = 1; i <= masterMask.
giveSize(); ++i ) {
436 if ( masterMask.
at(i) > 0 ) {
444void DofManager :: postInitialize()
447 for (
Dof *dof: *
this ) {
457 FEMComponent :: giveInputRecord(input);
463 for (
Dof *dof: *
this ) {
474 for (
int i = 1; i <=
dofidmask.giveSize(); ++i ) {
482 for (
int i = 1; i <=
dofidmask.giveSize(); ++i ) {
507void DofManager :: printOutputAt(FILE *stream,
TimeStep *tStep)
512 for (
Dof *dof: *
this ) {
518void DofManager :: printYourself()
521 printf(
"DofManager %d\n",
number);
522 for (
Dof *dof: *
this ) {
534 for (
Dof *dof: *
this ) {
542 FEMComponent :: saveContext(stream, mode);
545 if ( !stream.
write(this->giveNumberOfDofs()) ) {
550 for (
auto &dof : *
this ) {
551 _val = dof->giveDofType();
552 if ( !stream.
write(_val) ) {
555 _val = dof->giveDofID();
556 if ( !stream.
write(_val) ) {
559 dof->saveContext(stream, mode);
580 if ( !stream.
write(_val) ) {
588 for (
auto &dof : *
this ) {
589 dof->saveContext(stream, mode);
599 FEMComponent :: restoreContext(stream, mode);
603 if ( !stream.
read(_numberOfDofs) ) {
608 for (
auto &d:
dofArray) {
delete d; }
611 for (
int i = 0; i < _numberOfDofs; i++ ) {
613 if ( !stream.
read(dtype) ) {
616 if ( !stream.
read(dofid) ) {
641 if ( !stream.
read(_val) ) {
650 for (
auto &dof : this->
dofArray ) {
651 dof->restoreContext(stream, mode);
660 if ( dofIDArry.
giveSize() == 0 )
return;
663 for (
auto &dofid: dofIDArry ) {
665 if ( pos == this->
end() ) {
671 answer.
at(++k) = (*pos)->giveUnknown(mode, tStep);
689 for (
auto &dofid: dofIDArry ) {
691 if ( pos == this->
end() ) {
697 answer.
at(++k) = (*pos)->giveUnknown(field, mode, tStep);
713 for (
Dof *dof: *
this ) {
721 ValueModeType mode,
TimeStep *tStep)
726 for (
int dofid: dofIDArry ) {
727 answer.
at(j++) = this->
giveDofWithID( dofid )->giveBcValue(mode, tStep);
746 for (
Dof *d: *
this ) {
748 if ( ut == DisplacementVector || ut == EigenVector ) {
750 dofIDArry.
at(k) = D_u;
751 localVector.
at(k) = val;
754 dofIDArry.
at(k) = D_v;
755 localVector.
at(k) = val;
758 dofIDArry.
at(k) = D_w;
759 localVector.
at(k) = val;
762 }
else if ( ut == VelocityVector ) {
764 dofIDArry.
at(k) = V_u;
765 localVector.
at(k) = val;
768 dofIDArry.
at(k) = V_v;
769 localVector.
at(k) = val;
772 dofIDArry.
at(k) = V_w;
773 localVector.
at(k) = val;
777 OOFEM_ERROR(
"Can't produce vector for unknown type: %d", ut);
789 for (
int i = 1; i <= k; i++ ) {
790 if ( dofIDArry.
at(i) == D_u || dofIDArry.
at(i) == V_u ) {
791 answer.
at(1) = localVector.
at(i);
792 }
else if ( dofIDArry.
at(i) == D_v || dofIDArry.
at(i) == V_v ) {
793 answer.
at(2) = localVector.
at(i);
794 }
else if ( dofIDArry.
at(i) == D_w || dofIDArry.
at(i) == V_w ) {
795 answer.
at(3) = localVector.
at(i);
802bool DofManager :: hasAnySlaveDofs()
804 for (
Dof *dof: *
this ) {
814bool DofManager :: giveMasterDofMans(
IntArray &masters)
820 for (
Dof *dof: *
this ) {
824 for (
int j = 1; j <= _dof_masters.
giveSize(); j++ ) {
844 if ( !hasL2G && !hasM2L ) {
847 }
else if ( hasL2G && hasM2L ) {
849 }
else if ( hasL2G ) {
875 for (
Dof *dof: *
this ) {
882 for (
Dof *dof: *
this ) {
893 for (
int i = 1; i <= dofIDArry.
giveSize(); i++ ) {
894 this->
giveDofWithID(dofIDArry.
at(i))->computeDofTransformation(mstrContrs);
903bool DofManager :: requiresTransformation()
918 for (
Dof *dof: *
this ) {
928 for (
int i = 1; i <= size; i++ ) {
934int DofManager :: givePartitionsConnectivitySize()
937 int myrank = this->
giveDomain()->giveEngngModel()->giveRank();
946bool DofManager :: isLocal()
956 int myrank = this->
giveDomain()->giveEngngModel()->giveRank();
957 int minrank = myrank;
959 for (
int j = 1; j <= n; j++ ) {
963 if ( minrank == myrank ) {
virtual int read(int *data, std::size_t count)=0
Reads count integer values into array pointed by data.
virtual int write(const int *data, std::size_t count)=0
Writes count integer values from array pointed by data.
IntArray dofidmask
List of additional dof ids to include.
static ParamKey IPK_DofManager_remoteflag
static ParamKey IPK_DofManager_dofidmask
static ParamKey IPK_DofManager_mastermask
static ParamKey IPK_DofManager_nullflag
int giveNumberOfDofs() const
dofManagerParallelMode parallel_mode
virtual bool computeM2LTransformation(FloatMatrix &answer, const IntArray &dofIDArry)
bool hasSlaveDofs
Flag indicating whether receiver has slave DOFs.
const char * giveClassName() const override
IntArray loadArray
List of applied loads.
int giveNumberOfPrimaryMasterDofs(const IntArray &dofIDArray) const
std::vector< Dof * >::const_iterator findDofWithDofId(DofIDItem dofID) const
static ParamKey IPK_DofManager_boundaryflag
std ::map< int, int > dofICmap
Map from DofIDItem to ic (to be removed).
static ParamKey IPK_DofManager_doftypemask
static ParamKey IPK_DofManager_globnum
std ::map< int, int > dofMastermap
Map from DofIDItem to master node.
static ParamKey IPK_DofManager_load
std ::map< int, int > dofTypemap
Map from DofIDItem to dofType.
static ParamKey IPK_DofManager_partitions
std::vector< Dof * > dofArray
Array of DOFs.
Dof * giveDofWithID(int dofID) const
std ::map< int, int > dofBCmap
Map from DofIDItem to bc (to be removed).
std::vector< Dof * >::iterator begin()
virtual bool computeL2GTransformation(FloatMatrix &answer, const IntArray &dofIDArry)
std::vector< Dof * >::iterator end()
virtual bool hasAnySlaveDofs()
static ParamKey IPK_DofManager_ic
static ParamKey IPK_DofManager_bc
static ParamKey IPK_DofManager_sharedflag
virtual int giveNumberOfPrimaryMasterDofs()
virtual void giveMasterDofManArray(IntArray &answer)
virtual void giveEquationNumbers(IntArray &masterEqNumbers, const UnknownNumberingScheme &s)
virtual int askNewEquationNumber(TimeStep *tStep)=0
DofIDItem giveDofID() const
virtual double giveUnknown(ValueModeType mode, TimeStep *tStep)=0
virtual void updateLocalNumbering(EntityRenumberingFunctor &f)
virtual bool isPrimaryDof()
virtual void computeDofTransformation(FloatArray &masterContribs)
virtual void printYourself()
Prints the receiver state on stdout.
virtual void updateYourself(TimeStep *tStep)
virtual void giveDofIDs(IntArray &masterDofIDs)
virtual void restoreContext(DataStream &stream, ContextMode mode)
Restores the receiver state previously written in stream.
virtual void printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *tStep)
Domain * giveDomain() const
Domain * domain
Link to domain object, useful for communicating with other FEM components.
int number
Component number.
FEMComponent(int n, Domain *d)
void assemble(const FloatArray &fe, const IntArray &loc)
Index giveSize() const
Returns the size of receiver.
void resizeWithValues(Index s, std::size_t allocChunk=0)
void zero()
Zeroes all coefficients of receiver.
void rotatedWith(FloatMatrix &r, char mode)
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
void copySubVectorRow(const FloatArray &src, int sr, int sc)
void resize(Index rows, Index cols)
*Sets size of receiver to be an empty matrix It will have zero rows and zero columns size void clear()
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void zero()
Zeroes all coefficient of receiver.
virtual bcGeomType giveBCGeoType() const
virtual const IntArray & giveDofIDs() const
bool insertSortedOnce(int value, int allocChunk=0)
void followedBy(const IntArray &b, int allocChunk=0)
void resizeWithValues(int n, int allocChunk=0)
bool contains(int value) const
virtual void computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
bool checkIfSet(size_t componentIndex, size_t paramIndex)
std::optional< paramValue > getTempParam(size_t componentIndex, size_t paramIndex) const
virtual int giveDofEquationNumber(Dof *dof) const =0
#define OOFEM_WARNING(...)
FloatArrayF< N > min(const FloatArrayF< N > &a, const FloatArrayF< N > &b)
@ NodalLoadBGT
Concentrated nodal load.
dofManagerParallelMode
In parallel mode, this type indicates the mode of DofManager.
dofType
Dof Type, determines the type of DOF created.
ClassFactory & classFactory
@ CIO_IOERR
General IO error.
#define PM_UPDATE_TEMP_PARAMETER(_type, _pm, _ir, _componentnum, _paramkey, _prio)
#define PM_CHECK_FLAG_AND_REPORT(_pm, _ir, _componentnum, _paramkey, _prio, _flag)
#define PM_UPDATE_PARAMETER(_val, _pm, _ir, _componentnum, _paramkey, _prio)