OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
oofem::MasterDof Class Reference

Class representing "master" degree of freedom. More...

#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)
 Constructor. More...
 
 MasterDof (DofManager *aNode, DofIDItem id=Undef)
 
virtual ~MasterDof ()
 Destructor. More...
 
virtual dofType giveDofType ()
 Returns the type of the receiver. More...
 
virtual const char * giveClassName () const
 Returns class name of the receiver. More...
 
virtual int __giveEquationNumber () const
 Returns equation number of receiver, usually assigned by emodel. More...
 
virtual int __givePrescribedEquationNumber ()
 Returns prescribed equation number of receiver. More...
 
virtual int askNewEquationNumber (TimeStep *tStep)
 Asks EngngModel for new equation number. More...
 
virtual double giveUnknown (ValueModeType mode, TimeStep *tStep)
 The key method of class Dof. More...
 
virtual double giveUnknown (PrimaryField &field, ValueModeType, TimeStep *tStep)
 The key method of class Dof. More...
 
virtual bool hasBc (TimeStep *tStep)
 Test if Dof has active boundary condition. More...
 
virtual bool hasIc ()
 Test if Dof has initial condition. More...
 
virtual bool hasIcOn (ValueModeType)
 Test if Dof has initial condition of required ValueModeType. More...
 
virtual bool isPrimaryDof ()
 Tests if receiver is primary DOF. More...
 
virtual int giveBcId ()
 Returns the id of associated boundary condition, if there is any. More...
 
virtual int giveIcId ()
 Returns the id of associated initial condition, if there is any. More...
 
virtual void printYourself ()
 Prints the receiver state on stdout. More...
 
virtual void updateYourself (TimeStep *tStep)
 Updates receiver after finishing time step. More...
 
virtual void updateUnknownsDictionary (TimeStep *tStep, ValueModeType mode, double dofValue)
 Abstract function, allowing Dof to store its unknowns in its own private dictionary. More...
 
virtual double giveUnknownsDictionaryValue (TimeStep *tStep, ValueModeType mode)
 Access dictionary value, if not present zero is returned. More...
 
virtual contextIOResultType saveContext (DataStream &stream, ContextMode mode, void *obj=NULL)
 Stores receiver state to output stream. More...
 
virtual contextIOResultType restoreContext (DataStream &stream, ContextMode mode, void *obj=NULL)
 Restores the receiver state previously written in stream. More...
 
virtual void setBcId (int bcId)
 Overwrites the boundary condition id (0-inactive BC), intended for specific purposes such as coupling of bc's in multiscale simulations. More...
 
virtual void setIcId (int icId)
 Overwrites the initial condition id (0-inactive IC) More...
 
virtual void setEquationNumber (int newEquationNumber)
 Sets a specific equation number to receiver. More...
 
virtual DictionarygiveUnknowns ()
 Receives the dictionary of unknowns in receiver. More...
 
virtual int giveEqn ()
 Gives number for equation, negative for prescribed equations. More...
 
- Public Member Functions inherited from oofem::Dof
 Dof (DofManager *aNode, DofIDItem id=Undef)
 Constructor. More...
 
virtual ~Dof ()
 Destructor. More...
 
int giveDofManNumber () const
 
DofManagergiveDofManager () const
 
int giveDofManGlobalNumber () const
 
virtual double giveBcValue (ValueModeType mode, TimeStep *tStep)
 Returns value of boundary condition of dof if it is prescribed. More...
 
int giveEquationNumber (const UnknownNumberingScheme &s)
 Returns equation number of receiver for given equation numbering scheme. More...
 
virtual void giveEquationNumbers (IntArray &masterEqNumbers, const UnknownNumberingScheme &s)
 Returns equation number of receiver. More...
 
virtual void giveDofIDs (IntArray &masterDofIDs)
 As giveEquationNumbers but for dof IDs. More...
 
virtual void giveUnknowns (FloatArray &masterUnknowns, ValueModeType mode, TimeStep *tStep)
 The key method of class Dof. More...
 
virtual void giveUnknowns (FloatArray &masterUnknowns, PrimaryField &field, ValueModeType mode, TimeStep *tStep)
 The key method of class Dof. More...
 
virtual void computeDofTransformation (FloatArray &masterContribs)
 Computes dof transformation array, which describes the dependence of receiver value on values of master dofs. More...
 
virtual int giveNumberOfPrimaryMasterDofs ()
 
DofIDItem giveDofID () const
 Returns DofID value of receiver, which determines type of of unknown connected to receiver (e.g., u-displacement, v-displacement, ...). More...
 
void setDofID (DofIDItem id)
 Sets the ID of receiver. More...
 
virtual void giveMasterDofManArray (IntArray &answer)
 
virtual void updateLocalNumbering (EntityRenumberingFunctor &f)
 Local renumbering support. More...
 
virtual void printSingleOutputAt (FILE *file, TimeStep *tStep, char ch, ValueModeType mode, double scale=1.0)
 Prints Dof output (it prints value of unknown related to dof at given timeStep). More...
 
virtual void printMultipleOutputAt (FILE *File, TimeStep *tStep, char *ch, ValueModeType *mode, int nite)
 Prints Dof output (it prints value of unknown related to dof at given timeStep). More...
 
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). More...
 
virtual void setUnknowns (Dictionary *unknowns)
 Sets the dictionary of unknowns for receiver. More...
 
virtual int packUnknowns (DataStream &buff, ValueModeType mode, TimeStep *tStep)
 Packs specific DOF Manager's dofs unknowns into communication buffer. More...
 
virtual int unpackAndUpdateUnknown (DataStream &buff, ValueModeType mode, TimeStep *tStep)
 Unpacks DOF unknown from communication buffer and updates unknown if necessary. More...
 

Protected Member Functions

BoundaryConditiongiveBc ()
 Returns boundary condition of dof if it is prescribed. More...
 
InitialConditiongiveIc ()
 Returns initial condition of dof if it is prescribed. More...
 

Protected Attributes

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

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

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, equationNumber, and ic.

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

Definition at line 57 of file masterdof.C.

References bc, equationNumber, and ic.

oofem::MasterDof::~MasterDof ( )
virtual

Destructor.

Definition at line 63 of file masterdof.C.

Member Function Documentation

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

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 83 of file masterdof.C.

References equationNumber.

int oofem::MasterDof::__givePrescribedEquationNumber ( )
virtual

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 95 of file masterdof.C.

References equationNumber.

int oofem::MasterDof::askNewEquationNumber ( TimeStep tStep)
virtual

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 106 of file masterdof.C.

References oofem::Dof::dofID, oofem::Dof::dofManager, oofem::DofManager_null, equationNumber, oofem::FEMComponent::giveDomain(), oofem::Domain::giveEngngModel(), oofem::EngngModel::giveNewEquationNumber(), oofem::EngngModel::giveNewPrescribedEquationNumber(), oofem::Domain::giveNumber(), oofem::DofManager::giveParallelMode(), and hasBc().

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

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::Domain::giveBc(), oofem::FEMComponent::giveDomain(), oofem::GeneralBoundaryCondition::giveType(), and OOFEM_ERROR.

int oofem::MasterDof::giveBcId ( )
virtual

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 260 of file masterdof.C.

References bc.

virtual const char* oofem::MasterDof::giveClassName ( ) const
inlinevirtual

Returns class name of the receiver.

Reimplemented from oofem::Dof.

Definition at line 121 of file masterdof.h.

virtual dofType oofem::MasterDof::giveDofType ( )
inlinevirtual

Returns the type of the receiver.

Implements oofem::Dof.

Definition at line 120 of file masterdof.h.

virtual int oofem::MasterDof::giveEqn ( )
inlinevirtual

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.

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

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 130 of file masterdof.C.

References oofem::Dof::dofManager, oofem::FEMComponent::giveDomain(), oofem::Domain::giveIc(), ic, and OOFEM_ERROR.

Referenced by giveUnknown(), and hasIcOn().

int oofem::MasterDof::giveIcId ( )
virtual

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 265 of file masterdof.C.

References ic.

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

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 142 of file masterdof.C.

References oofem::Dof::dofManager, oofem::DofManager_null, oofem::InitialCondition::give(), oofem::Dof::giveBcValue(), oofem::FEMComponent::giveDomain(), oofem::Domain::giveEngngModel(), giveIc(), oofem::TimeStep::giveNumber(), oofem::EngngModel::giveNumberOfTimeStepWhenIcApply(), oofem::DofManager::giveParallelMode(), hasBc(), hasIcOn(), and oofem::EngngModel::requiresUnknownsDictionaryUpdate().

double oofem::MasterDof::giveUnknown ( PrimaryField field,
ValueModeType  mode,
TimeStep tStep 
)
virtual

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::InitialCondition::give(), oofem::Dof::giveBcValue(), oofem::FEMComponent::giveDomain(), oofem::Domain::giveEngngModel(), giveIc(), oofem::TimeStep::giveNumber(), oofem::EngngModel::giveNumberOfTimeStepWhenIcApply(), oofem::DofManager::giveParallelMode(), oofem::PrimaryField::giveUnknownValue(), hasBc(), and hasIcOn().

virtual Dictionary* oofem::MasterDof::giveUnknowns ( )
inlinevirtual

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.

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

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 285 of file masterdof.C.

References oofem::Dictionary::at(), oofem::Dof::dofManager, oofem::FEMComponent::giveDomain(), oofem::Domain::giveEngngModel(), oofem::EngngModel::giveUnknownDictHashIndx(), and unknowns.

bool oofem::MasterDof::hasBc ( TimeStep tStep)
virtual

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 217 of file masterdof.C.

References bc, oofem::Dof::dofManager, oofem::DofManager_null, oofem::Domain::giveBc(), oofem::FEMComponent::giveDomain(), oofem::DofManager::giveParallelMode(), oofem::GeneralBoundaryCondition::isImposed(), and OOFEM_ERROR.

Referenced by askNewEquationNumber(), and giveUnknown().

bool oofem::MasterDof::hasIc ( )
virtual

Test if Dof has initial condition.

Returns
True if IC exists, false otherwise.

Implements oofem::Dof.

Definition at line 237 of file masterdof.C.

References ic, and OOFEM_ERROR.

Referenced by hasIcOn().

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

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 249 of file masterdof.C.

References giveIc(), oofem::InitialCondition::hasConditionOn(), and hasIc().

Referenced by giveUnknown().

virtual bool oofem::MasterDof::isPrimaryDof ( )
inlinevirtual

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.

void oofem::MasterDof::printYourself ( )
virtual

Prints the receiver state on stdout.

Reimplemented from oofem::Dof.

Definition at line 291 of file masterdof.C.

References bc, oofem::Dof::dofID, oofem::Dof::dofManager, equationNumber, oofem::FEMComponent::giveClassName(), and oofem::FEMComponent::giveNumber().

virtual void oofem::MasterDof::setBcId ( int  bcId)
inlinevirtual

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.

virtual void oofem::MasterDof::setEquationNumber ( int  equationNumber)
inlinevirtual

Sets a specific equation number to receiver.

Parameters
equationNumberNew equation number.

Reimplemented from oofem::Dof.

Definition at line 153 of file masterdof.h.

virtual void oofem::MasterDof::setIcId ( int  icId)
inlinevirtual

Overwrites the initial condition id (0-inactive IC)

Reimplemented from oofem::Dof.

Definition at line 152 of file masterdof.h.

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

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 276 of file masterdof.C.

References oofem::Dictionary::at(), oofem::Dof::dofManager, oofem::FEMComponent::giveDomain(), oofem::Domain::giveEngngModel(), oofem::EngngModel::giveUnknownDictHashIndx(), and unknowns.

void oofem::MasterDof::updateYourself ( TimeStep tStep)
virtual

Updates receiver after finishing time step.

Parameters
tStepFinished time step.

Reimplemented from oofem::Dof.

Definition at line 270 of file masterdof.C.

References oofem::Dof::updateYourself().

Member Data Documentation

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(), printYourself(), restoreContext(), and saveContext().

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(), MasterDof(), printYourself(), restoreContext(), and saveContext().

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(), restoreContext(), and saveContext().

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 documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:38 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011