OOFEM 3.0
Loading...
Searching...
No Matches
oofem::MasterDof Class Reference

#include <masterdof.h>

Inheritance diagram for oofem::MasterDof:
Collaboration diagram for oofem::MasterDof:

Public Member Functions

 MasterDof (DofManager *aNode, int nbc, int nic, DofIDItem id)
 MasterDof (DofManager *aNode, DofIDItem id=Undef)
virtual ~MasterDof ()
 Destructor.
dofType giveDofType () override
 Returns the type of the receiver.
const char * giveClassName () const override
 Returns class name of the receiver.
int __giveEquationNumber () const override
int __givePrescribedEquationNumber () override
int askNewEquationNumber (TimeStep *tStep) override
double giveUnknown (ValueModeType mode, TimeStep *tStep) override
double giveUnknown (PrimaryField &field, ValueModeType, TimeStep *tStep) override
bool hasBc (TimeStep *tStep) override
bool hasIc () override
bool hasIcOn (ValueModeType) override
bool isPrimaryDof () override
int giveBcId () override
int giveIcId () override
void printYourself () override
 Prints the receiver state on stdout.
void updateYourself (TimeStep *tStep) override
void updateUnknownsDictionary (TimeStep *tStep, ValueModeType mode, double dofValue) override
double giveUnknownsDictionaryValue (TimeStep *tStep, ValueModeType mode) override
void saveContext (DataStream &stream, ContextMode mode) override
 Stores receiver state to output stream.
void restoreContext (DataStream &stream, ContextMode mode) override
 Restores the receiver state previously written in stream.
void setBcId (int bcId) override
 Overwrites the boundary condition id (0-inactive BC), intended for specific purposes such as coupling of bc's in multiscale simulations.
void setIcId (int icId) override
 Overwrites the initial condition id (0-inactive IC).
void setEquationNumber (int newEquationNumber) override
DictionarygiveUnknowns () override
int giveEqn () override
Public Member Functions inherited from oofem::Dof
 Dof (DofManager *aNode, DofIDItem id=Undef)
virtual ~Dof ()
 Destructor.
int giveDofManNumber () const
DofManagergiveDofManager () const
int giveDofManGlobalNumber () const
virtual double giveBcValue (ValueModeType mode, TimeStep *tStep)
int giveEquationNumber (const UnknownNumberingScheme &s)
virtual void giveEquationNumbers (IntArray &masterEqNumbers, const UnknownNumberingScheme &s)
virtual void giveDofIDs (IntArray &masterDofIDs)
virtual void giveUnknowns (FloatArray &masterUnknowns, ValueModeType mode, TimeStep *tStep)
virtual void giveUnknowns (FloatArray &masterUnknowns, PrimaryField &field, ValueModeType mode, TimeStep *tStep)
virtual void computeDofTransformation (FloatArray &masterContribs)
virtual int giveNumberOfPrimaryMasterDofs ()
DofIDItem giveDofID () const
void setDofID (DofIDItem id)
virtual void giveMasterDofManArray (IntArray &answer)
virtual void updateLocalNumbering (EntityRenumberingFunctor &f)
virtual void printSingleOutputAt (FILE *file, TimeStep *tStep, char ch, ValueModeType mode, double scale=1.0)
virtual void printMultipleOutputAt (FILE *File, TimeStep *tStep, char *ch, ValueModeType *mode, int nite)
void printSingleOutputWithAdditionAt (FILE *File, TimeStep *tStep, char ch, ValueModeType mode, double addend)
std::string errorInfo (const char *func) const
 Returns string for prepending output (used by error reporting macros).
virtual void setUnknowns (Dictionary *unknowns)
virtual int packUnknowns (DataStream &buff, ValueModeType mode, TimeStep *tStep)
virtual int unpackAndUpdateUnknown (DataStream &buff, ValueModeType mode, TimeStep *tStep)

Protected Member Functions

BoundaryConditiongiveBc () override
InitialConditiongiveIc () override

Protected Attributes

int equationNumber
 Corresponding equation number (positive value) or prescribed equation number (negative value).
int bc
 Boundary condition number associated to dof.
int ic
 Initial condition number associated to dof.
Dictionary unknowns
 Unknowns dictionary to support changes of static system.
Protected Attributes inherited from oofem::Dof
DofManagerdofManager
 Link to related DofManager.
DofIDItem dofID
 Physical meaning of DOF.

Detailed Description

Class representing "master" degree of freedom. Master is degree of freedom, which has its related unknown and corresponding equation number.

This class implements a nodal degree of freedom. A dof is usually attribute of one node.

'number' and 'node' are used for reading/writing data in the data file. 'equationNumber' keeps the number of the associated equation in the linear system (value>0) or the associated prescribed equation number if the dof is subjected to a boundary condition (b.c.) (value<0). 'bc' is the number of the b.c. the dof is subjected to, if any. 'DofID' is parameter determining physical meaning of receiver. This parameter is also used in member function giveUnknownType, which returns CharType type according to DofID parameter.

I don't know whether to implement following feature (now not implemented) 'unknowns' and 'pastUnknowns' are the dictionaries where the dof stores its unknowns (e.g., the displacement 'd', the velocity 'v' and the acceleration 'a'), at the current time step and at the previous one.

TASKS

  • Equation numbering, in method 'giveEquationNumber' and 'givePrescribedEquationNumber' ;
  • Managing its b.c. and its i.c., if any (methods 'hasBc', 'giveBc', etc);
  • Managing its unknowns. This includes retrieving the associated solution from the engineering model, or from receiver's dictionary (based on emodel->requiresNodeUnknowsDictionaryUpdate() function, which determines whether to use dictionary or ask unknowns values from emodel)
  • Managing physical meaning of dof (dofID variable)

REMARKS

  • Class Dof is not a subclass of FEMComponent : a dof belongs to a single node, not to the domain ;
  • Class Dof is not restricted to structural analysis problems. Unknowns may also be pressures, temperatures, etc.
  • Method give returns unknown value quantity according to ValueModeType parameter, CharType parameter is used to check whether physical meaning of unknown corresponds.

Definition at line 92 of file masterdof.h.

Constructor & Destructor Documentation

◆ MasterDof() [1/2]

oofem::MasterDof::MasterDof ( DofManager * aNode,
int nbc,
int nic,
DofIDItem id )

Constructor. Creates master dof with number i, belonging to DofManager aNode and with physical meaning described by id.

Parameters
iDOF number.
aNodeDofManager which possess DOF.
nbcNumber of associated boundary condition, zero if none.
nicNumber of associated initial condition, zero if none.
idPhysical meaning type.
See also
cltypes.h, DofIDItem type

Definition at line 48 of file masterdof.C.

References bc, oofem::Dof::Dof(), equationNumber, and ic.

◆ MasterDof() [2/2]

oofem::MasterDof::MasterDof ( DofManager * aNode,
DofIDItem id = Undef )

Definition at line 57 of file masterdof.C.

References bc, oofem::Dof::Dof(), equationNumber, and ic.

◆ ~MasterDof()

oofem::MasterDof::~MasterDof ( )
virtual

Destructor.

Definition at line 63 of file masterdof.C.

Member Function Documentation

◆ __giveEquationNumber()

int oofem::MasterDof::__giveEquationNumber ( ) const
overridevirtual

Returns equation number of receiver, usually assigned by emodel. If Dof has active BC, returned equation number is zero. After initializing Dof by calling constructor, Dof has no equation number assigned. When firstly invoked, this function asks EngngModel object for next equation prescribed equation number (this will increase also total number of equation at EngngModel level). Note: By asking nodal code numbers or element code numbers when initializing code numbers in EngngMode, designer should alter equation numbering strategy.

Returns
Equation number of DOF.

Implements oofem::Dof.

Definition at line 82 of file masterdof.C.

References equationNumber.

◆ __givePrescribedEquationNumber()

int oofem::MasterDof::__givePrescribedEquationNumber ( )
overridevirtual

Returns prescribed equation number of receiver. If Dof has inactive BC, returned prescribed equation number is zero. If Dof has active BC, then the corresponding prescribed equation number is returned. is zero. After initializing Dof by calling constructor, Dof has no prescribed equation number assigned. When firstly invoked, this function asks EngngModel object for next equation or prescribed equation number (this will increase also total number of equation at EngngModel level). Note: By asking nodal code numbers or element code numbers when initializing code numbers in EngngMode, designer should alter equation numbering strategy.

Returns
Prescribed equation number.

Implements oofem::Dof.

Definition at line 94 of file masterdof.C.

References equationNumber.

◆ askNewEquationNumber()

int oofem::MasterDof::askNewEquationNumber ( TimeStep * tStep)
overridevirtual

Asks EngngModel for new equation number. Necessary for EngngModels supporting changes of static system during solution. Then it is necessary to force equation renumbering after finishing each time step.

Parameters
tStepTime step determining the time.
See also
Dof::updateUnknownsDictionary
EngngModel::requiresUnknownsDictionaryUpdate

Implements oofem::Dof.

Definition at line 105 of file masterdof.C.

References oofem::Dof::dofManager, oofem::DofManager_null, equationNumber, oofem::EngngModel::giveNewEquationNumber(), oofem::EngngModel::giveNewPrescribedEquationNumber(), and hasBc().

◆ giveBc()

BoundaryCondition * oofem::MasterDof::giveBc ( )
overrideprotectedvirtual

Returns boundary condition of dof if it is prescribed.

Returns
NULL if no BC applied, otherwise pointer to corresponding BC.

Reimplemented from oofem::Dof.

Definition at line 68 of file masterdof.C.

References bc, oofem::DirichletBT, oofem::Dof::dofManager, oofem::GeneralBoundaryCondition::giveType(), and OOFEM_ERROR.

◆ giveBcId()

int oofem::MasterDof::giveBcId ( )
overridevirtual

Returns the id of associated boundary condition, if there is any. Used only for printing purposes. In general, id could not be used to decide whether BC is active. Use appropriate services instead.

Returns
Id of associated Boundary condition, zero otherwise

Implements oofem::Dof.

Definition at line 261 of file masterdof.C.

References bc.

◆ giveClassName()

const char * oofem::MasterDof::giveClassName ( ) const
inlineoverridevirtual

Returns class name of the receiver.

Reimplemented from oofem::Dof.

Definition at line 121 of file masterdof.h.

◆ giveDofType()

dofType oofem::MasterDof::giveDofType ( )
inlineoverridevirtual

Returns the type of the receiver.

Implements oofem::Dof.

Definition at line 120 of file masterdof.h.

◆ giveEqn()

int oofem::MasterDof::giveEqn ( )
inlineoverridevirtual

Gives number for equation, negative for prescribed equations.

Returns
Equation number of receiver.

Reimplemented from oofem::Dof.

Definition at line 155 of file masterdof.h.

References equationNumber.

◆ giveIc()

InitialCondition * oofem::MasterDof::giveIc ( )
overrideprotectedvirtual

Returns initial condition of dof if it is prescribed.

Returns
NULL if no IC applied, otherwise pointer to corresponding IC.

Reimplemented from oofem::Dof.

Definition at line 129 of file masterdof.C.

References oofem::Dof::dofManager, ic, and OOFEM_ERROR.

Referenced by giveUnknown(), giveUnknown(), and hasIcOn().

◆ giveIcId()

int oofem::MasterDof::giveIcId ( )
overridevirtual

Returns the id of associated initial condition, if there is any. Used only for printing purposes. In general, id could not be used to decide whether IC is active. Use appropriate services instead.

Returns
Id of associated initial condition, zero otherwise

Implements oofem::Dof.

Definition at line 266 of file masterdof.C.

References ic.

◆ giveUnknown() [1/2]

double oofem::MasterDof::giveUnknown ( PrimaryField & field,
ValueModeType mode,
TimeStep * tStep )
overridevirtual

The key method of class Dof. Returns the value of the unknown of the receiver at given time step associated to given field.

Parameters
fieldField used to provide values.
modeMode of unknown.
tStepTime step when unknown is requested. See documentation of particular EngngModel class for valid tStep values (most implementation can return only values for current and possibly for previous time step).
Returns
Value of unknown. If activeBC exist then returns value prescribed by BC. If tStep is time step when IC apply, returns value given by this IC.

Implements oofem::Dof.

Definition at line 190 of file masterdof.C.

References oofem::Dof::dofManager, oofem::DofManager_null, oofem::Dof::giveBcValue(), giveIc(), oofem::TimeStep::giveNumber(), oofem::PrimaryField::giveUnknownValue(), hasBc(), and hasIcOn().

◆ giveUnknown() [2/2]

double oofem::MasterDof::giveUnknown ( ValueModeType mode,
TimeStep * tStep )
overridevirtual

The key method of class Dof. Returns the value of the unknown of the receiver at given time step. Unknown is characterized by its physical meaning (i.g., displacement) an by its mode (e.g., value of displacement, velocity of displacement or acceleration of displacement). UnknownType of requested unknown must be same as UnknownType of Dof.

Parameters
modeMode of unknown (e.g, total value, velocity or acceleration of unknown).
tStepTime step when unknown is requested. See documentation of particular EngngModel class for valid tStep values (most implementation can return only values for current and possibly for previous time step).
Returns
Value of unknown. If activeBC exist then returns value prescribed by BC. If tStep is time step when IC apply, returns value given by this IC.

Implements oofem::Dof.

Definition at line 140 of file masterdof.C.

References oofem::Dof::dofManager, oofem::DofManager_null, oofem::Dof::giveBcValue(), giveIc(), oofem::TimeStep::giveNumber(), hasBc(), and hasIcOn().

◆ giveUnknowns()

Dictionary * oofem::MasterDof::giveUnknowns ( )
inlineoverridevirtual

Receives the dictionary of unknowns in receiver.

Returns
Dictionary of unknowns for DOF.

Reimplemented from oofem::Dof.

Definition at line 154 of file masterdof.h.

◆ giveUnknownsDictionaryValue()

double oofem::MasterDof::giveUnknownsDictionaryValue ( TimeStep * tStep,
ValueModeType mode )
overridevirtual

Access dictionary value, if not present zero is returned.

Parameters
tStepTime step.
modeMode of value.
Returns
The requested value.

Reimplemented from oofem::Dof.

Definition at line 286 of file masterdof.C.

References oofem::Dof::dofManager, and unknowns.

◆ hasBc()

bool oofem::MasterDof::hasBc ( TimeStep * tStep)
overridevirtual

Test if Dof has active boundary condition.

Parameters
tStepTime when test is evaluated.
Returns
True if active BC exists, false otherwise.

Implements oofem::Dof.

Definition at line 218 of file masterdof.C.

References bc, oofem::Dof::dofManager, oofem::DofManager_null, and OOFEM_ERROR.

Referenced by askNewEquationNumber(), giveUnknown(), and giveUnknown().

◆ hasIc()

bool oofem::MasterDof::hasIc ( )
overridevirtual

Test if Dof has initial condition.

Returns
True if IC exists, false otherwise.

Implements oofem::Dof.

Definition at line 238 of file masterdof.C.

References ic, and OOFEM_ERROR.

Referenced by hasIcOn().

◆ hasIcOn()

bool oofem::MasterDof::hasIcOn ( ValueModeType u)
overridevirtual

Test if Dof has initial condition of required ValueModeType.

Parameters
uType of required IC.
Returns
True if IC exists, false otherwise.
See also
ValueModeType

Implements oofem::Dof.

Definition at line 250 of file masterdof.C.

References giveIc(), and hasIc().

Referenced by giveUnknown(), and giveUnknown().

◆ isPrimaryDof()

bool oofem::MasterDof::isPrimaryDof ( )
inlineoverridevirtual

Tests if receiver is primary DOF. Dof is primary if it possess or directly represent certain DOF. If it is linked somehow (rigid arm, doubled node) to other DOF(s) then it is not primary DOF.

Returns
True if receiver is primary DOF, false otherwise (default).

Reimplemented from oofem::Dof.

Definition at line 136 of file masterdof.h.

◆ printYourself()

void oofem::MasterDof::printYourself ( )
overridevirtual

Prints the receiver state on stdout.

Reimplemented from oofem::Dof.

Definition at line 292 of file masterdof.C.

References bc, oofem::Dof::dofID, oofem::Dof::dofManager, and equationNumber.

◆ restoreContext()

void oofem::MasterDof::restoreContext ( DataStream & stream,
ContextMode mode )
overridevirtual

Restores the receiver state previously written in stream.

Reimplemented from oofem::Dof.

Definition at line 324 of file masterdof.C.

References bc, oofem::CIO_IOERR, CM_Definition, CM_UnknownDictState, oofem::Dof::dofManager, equationNumber, ic, oofem::DataStream::read(), THROW_CIOERR, and unknowns.

◆ saveContext()

void oofem::MasterDof::saveContext ( DataStream & stream,
ContextMode mode )
overridevirtual

Stores receiver state to output stream.

Reimplemented from oofem::Dof.

Definition at line 299 of file masterdof.C.

References bc, oofem::CIO_IOERR, CM_Definition, CM_UnknownDictState, oofem::Dof::dofManager, equationNumber, ic, THROW_CIOERR, unknowns, and oofem::DataStream::write().

◆ setBcId()

void oofem::MasterDof::setBcId ( int bcId)
inlineoverridevirtual

Overwrites the boundary condition id (0-inactive BC), intended for specific purposes such as coupling of bc's in multiscale simulations.

Reimplemented from oofem::Dof.

Definition at line 151 of file masterdof.h.

◆ setEquationNumber()

void oofem::MasterDof::setEquationNumber ( int equationNumber)
inlineoverridevirtual

Sets a specific equation number to receiver.

Parameters
equationNumberNew equation number.

Reimplemented from oofem::Dof.

Definition at line 153 of file masterdof.h.

◆ setIcId()

void oofem::MasterDof::setIcId ( int icId)
inlineoverridevirtual

Overwrites the initial condition id (0-inactive IC).

Reimplemented from oofem::Dof.

Definition at line 152 of file masterdof.h.

◆ updateUnknownsDictionary()

void oofem::MasterDof::updateUnknownsDictionary ( TimeStep * tStep,
ValueModeType mode,
double dofValue )
overridevirtual

Abstract function, allowing Dof to store its unknowns in its own private dictionary. Dof then uses this dictionary instead of forwarding the requests to EngngModel (with equationNUmber as parameter). If EngngModel does not support changes of static system (see EngngModel::requiresUnknownsDictionaryUpdate method), the dof forwards the requests for its unknowns to EngngModel, where unknowns are naturally kept. This is possible, because dof equation number is same during whole solution. But when changes of static system are allowed, several problem arise. For example by solving simple incremental static with allowed static changes, the incremental displacement vector of structure can not be added to total displacement vector of structure, because equation numbers may have changed, and one can not simply add these vector to obtain new total displacement vector, because incompatible displacement will be added. To solve this problem, unknown dictionary at dof level has been assumed. Dof then keeps its unknowns in its own private dictionary. After computing increment of solution, engngModel updates for each dof its unknowns in its dictionary (using updateUnknownsDictionary function). For aforementioned example engngModel updates incremental values but also total value by asking dof for previous total value (dof will use its dictionary, does not asks back EngngModel) adds corresponding increment and updates total value in dictionary. In fact on EngngModel level only incremental solution is stored, but total values are always stored in dofs dictionaries. Implementation is not provided, only interface declared. Children must implement this method.

Parameters
tStepTime step when unknowns are updated. In current version it is unused parameter. It is EngngModel responsibility to update values, and values stored in dictionary are always related to timeStep when they were lastly updated.
modeMode of stored unknown.
dofValueValue of unknown. Old value will generally be lost.
See also
EngngModel::requiresUnknownsDictionaryUpdate

Reimplemented from oofem::Dof.

Definition at line 277 of file masterdof.C.

References oofem::Dof::dofManager, and unknowns.

◆ updateYourself()

void oofem::MasterDof::updateYourself ( TimeStep * tStep)
overridevirtual

Updates receiver after finishing time step.

Parameters
tStepFinished time step.

Reimplemented from oofem::Dof.

Definition at line 271 of file masterdof.C.

Member Data Documentation

◆ bc

int oofem::MasterDof::bc
protected

Boundary condition number associated to dof.

Definition at line 98 of file masterdof.h.

Referenced by giveBc(), giveBcId(), hasBc(), MasterDof(), MasterDof(), printYourself(), restoreContext(), and saveContext().

◆ equationNumber

int oofem::MasterDof::equationNumber
protected

Corresponding equation number (positive value) or prescribed equation number (negative value).

Definition at line 96 of file masterdof.h.

Referenced by __giveEquationNumber(), __givePrescribedEquationNumber(), askNewEquationNumber(), giveEqn(), MasterDof(), MasterDof(), printYourself(), restoreContext(), and saveContext().

◆ ic

int oofem::MasterDof::ic
protected

Initial condition number associated to dof.

Definition at line 100 of file masterdof.h.

Referenced by giveIc(), giveIcId(), hasIc(), MasterDof(), MasterDof(), restoreContext(), and saveContext().

◆ unknowns

Dictionary oofem::MasterDof::unknowns
protected

Unknowns dictionary to support changes of static system.

Definition at line 102 of file masterdof.h.

Referenced by giveUnknownsDictionaryValue(), restoreContext(), saveContext(), and updateUnknownsDictionary().


The documentation for this class was generated from the following files:

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