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

Abstract class representing field of primary variables (those, which are unknown and are typically associated to nodes). More...

#include <primaryfield.h>

+ Inheritance diagram for oofem::PrimaryField:
+ Collaboration diagram for oofem::PrimaryField:

Public Member Functions

 PrimaryField (EngngModel *a, int idomain, FieldType ft, int nHist)
 Constructor. More...
 
virtual ~PrimaryField ()
 
virtual void initialize (ValueModeType mode, TimeStep *tStep, FloatArray &answer, const UnknownNumberingScheme &s)
 Copy unknowns from previous solution or DOF's dictionary to the solution vector. More...
 
void storeDofManager (TimeStep *tStep, DofManager &dman)
 
void storeInDofDictionaries (TimeStep *tStep)
 
void readDofManager (TimeStep *tStep, DofManager &dman)
 
void readFromDofDictionaries (TimeStep *tStep)
 
virtual void applyDefaultInitialCondition ()
 Applies the default initial values values for all DOFs (0) in given domain. More...
 
void applyInitialCondition (InitialCondition &ic)
 Applies initial condition to all DOFs. More...
 
virtual void applyBoundaryCondition (TimeStep *tStep)
 Applies all boundary conditions to all prescribed DOFs. More...
 
void applyBoundaryCondition (BoundaryCondition &bc, TimeStep *tStep)
 Applies the boundary condition to all prescribed DOFs in given domain. More...
 
virtual double giveUnknownValue (Dof *dof, ValueModeType mode, TimeStep *tStep)
 
virtual int evaluateAt (FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep)
 Evaluates the field at given point. More...
 
virtual int evaluateAt (FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep)
 Evaluates the field at given DofManager. More...
 
virtual int __evaluateAt (FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep, IntArray *dofId)
 Evaluates the field at given DOF manager, allows to select specific dofs using mask. More...
 
virtual int __evaluateAt (FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep, IntArray *dofId)
 Evaluates the field at given point, allows to select specific dofs using mask. More...
 
virtual FloatArraygiveSolutionVector (TimeStep *tStep)
 
virtual void update (ValueModeType mode, TimeStep *tStep, const FloatArray &vectorToStore, const UnknownNumberingScheme &s)
 Project vectorToStore back to DOF's dictionary. More...
 
virtual void advanceSolution (TimeStep *tStep)
 Brings up a new solution vector for given time step. More...
 
virtual contextIOResultType saveContext (DataStream &stream, ContextMode mode)
 Stores receiver state to output stream. More...
 
virtual contextIOResultType restoreContext (DataStream &stream, ContextMode mode)
 Restores the receiver state previously written in stream. More...
 
virtual const char * giveClassName () const
 
int giveActualStepNumber ()
 
- Public Member Functions inherited from oofem::Field
 Field (FieldType b)
 Constructor. More...
 
virtual ~Field ()
 
FieldType giveType ()
 Returns the type of receiver. More...
 
std::string errorInfo (const char *func) const
 Returns string for prepending output (used by error reporting macros). More...
 

Protected Member Functions

int resolveIndx (TimeStep *tStep, int shift)
 
FloatArraygiveSolutionVector (int)
 
FloatArraygivePrescribedVector (int)
 

Protected Attributes

int actualStepNumber
 
int actualStepIndx
 
int nHistVectors
 
std::vector< FloatArraysolutionVectors
 
std::vector< FloatArrayprescribedVectors
 
std::vector< TimeStepsolStepList
 
EngngModelemodel
 
int domainIndx
 
- Protected Attributes inherited from oofem::Field
FieldType type
 

Detailed Description

Abstract class representing field of primary variables (those, which are unknown and are typically associated to nodes).

In the current design the primary field is understood as simple database, that allows to keep track of the history of a solution vector representing primary field. The history is kept as sequence of solution vectors. The history depth kept can be selected. PrimaryField class basically provides access to time-dependent vectors of the field of unknowns. It adds the possibility to further interpolate the field values using element interpolation functions. The prescribed values of the field are not maintained, since they can be obtained directly from corresponding DOFs of associated domain.

As the PrimaryField stores the state directly in solution vectors that are usually directly updated by EngngModel, it may contain a mix of different fields (this is especially true for strongly coupled problems). Then masked primary field can be used to select only certain DOFs (based on DofID) from its master PrimaryField.

Note
This primary field will always assume default numbering schemes.

Definition at line 104 of file primaryfield.h.

Constructor & Destructor Documentation

oofem::PrimaryField::PrimaryField ( EngngModel a,
int  idomain,
FieldType  ft,
int  nHist 
)

Constructor.

Creates a field of given type associated to given domain. Not using pointer to domain, because this will prevent the use of PrimaryField as an EngngModel attribute. This is because the domain does not exists when PrimaryField is created (this is when EngngModel is created).

Parameters
aEngineering model which field belongs to.
idomainIndex of domain for field.
ftType of stored field.
nHistNumber of old time steps to store.

Definition at line 49 of file primaryfield.C.

References actualStepIndx, actualStepNumber, domainIndx, emodel, and nHistVectors.

oofem::PrimaryField::~PrimaryField ( )
virtual

Definition at line 60 of file primaryfield.C.

Member Function Documentation

int oofem::PrimaryField::__evaluateAt ( FloatArray answer,
DofManager dman,
ValueModeType  mode,
TimeStep tStep,
IntArray dofId 
)
virtual

Evaluates the field at given DOF manager, allows to select specific dofs using mask.

Parameters
answerEvaluated field at dman.
dmanDOF manager of interest.
modeMode of evaluated unknowns.
tStepTime step of interest.
dofIdDof mask, id set to NULL, all Dofs evaluated.
Returns
Error code (0=ok, 1=point not found in domain).

Definition at line 349 of file primaryfield.C.

References domainIndx, emodel, oofem::DofManager::giveCompleteUnknownVector(), oofem::DofManager::giveCoordinates(), oofem::FEMComponent::giveDomain(), oofem::EngngModel::giveDomain(), and oofem::DofManager::giveUnknownVector().

Referenced by oofem::MaskedPrimaryField::evaluateAt(), and evaluateAt().

int oofem::PrimaryField::__evaluateAt ( FloatArray answer,
const FloatArray coords,
ValueModeType  mode,
TimeStep tStep,
IntArray dofId 
)
virtual

Evaluates the field at given point, allows to select specific dofs using mask.

Parameters
answerEvaluated field at coords.
coordsCoordinates of the point of interest.
modeMode of evaluated unknowns.
tStepTime step of interest.
dofIdDof mask, id set to NULL, all Dofs evaluated.
Returns
Error code (0=ok, 1=point not found in domain)

Definition at line 369 of file primaryfield.C.

References oofem::IntArray::at(), oofem::FloatArray::at(), oofem::Element::computeField(), domainIndx, oofem::EIPrimaryFieldInterface::EIPrimaryFieldI_evaluateFieldVectorAt(), oofem::EIPrimaryFieldInterfaceType, emodel, oofem::IntArray::findFirstIndexOf(), oofem::EngngModel::giveDomain(), oofem::SpatialLocalizer::giveElementClosestToPoint(), oofem::SpatialLocalizer::giveElementContainingPoint(), oofem::Element::giveElementDofIDMask(), oofem::FEMComponent::giveInterface(), oofem::IntArray::giveSize(), oofem::Domain::giveSpatialLocalizer(), OOFEM_ERROR, oofem::FloatArray::resize(), and oofem::FloatArray::zero().

void oofem::PrimaryField::advanceSolution ( TimeStep tStep)
virtual

Brings up a new solution vector for given time step.

Parameters
tStepTime step for new solution vector.

Reimplemented in oofem::DofDistributedPrimaryField.

Definition at line 483 of file primaryfield.C.

References actualStepIndx, actualStepNumber, oofem::TimeStep::giveNumber(), givePrescribedVector(), giveSolutionVector(), nHistVectors, OOFEM_ERROR, resolveIndx(), and solStepList.

Referenced by oofem::DofDistributedPrimaryField::advanceSolution(), oofem::CBS::applyIC(), and oofem::CBS::solveYourselfAt().

void oofem::PrimaryField::applyBoundaryCondition ( TimeStep tStep)
virtual
void oofem::PrimaryField::applyBoundaryCondition ( BoundaryCondition bc,
TimeStep tStep 
)
int oofem::PrimaryField::evaluateAt ( FloatArray answer,
const FloatArray coords,
ValueModeType  mode,
TimeStep tStep 
)
virtual

Evaluates the field at given point.

Parameters
answerEvaluated field at point.
coordsCoordinates of the point of interest.
modeMode of evaluated unknowns.
tStepTime step of interest.
Returns
Error code (0-ok, 1-point not found in domain).

Implements oofem::Field.

Definition at line 427 of file primaryfield.C.

References __evaluateAt().

int oofem::PrimaryField::evaluateAt ( FloatArray answer,
DofManager dman,
ValueModeType  mode,
TimeStep tStep 
)
virtual

Evaluates the field at given DofManager.

Parameters
answerEvaluated field at dman.
dmanDOF manager to evaluate at.
modeMode of evaluated unknowns.
tStepTime step of interest.
Returns
Error code (0-ok, 1-point not found in domain).

Implements oofem::Field.

Definition at line 435 of file primaryfield.C.

References __evaluateAt().

int oofem::PrimaryField::giveActualStepNumber ( )
inline

Definition at line 243 of file primaryfield.h.

virtual const char* oofem::PrimaryField::giveClassName ( ) const
inlinevirtual
Returns
Class name of the receiver.

Implements oofem::Field.

Definition at line 240 of file primaryfield.h.

FloatArray * oofem::PrimaryField::givePrescribedVector ( int  i)
protected
FloatArray * oofem::PrimaryField::giveSolutionVector ( TimeStep tStep)
virtual
FloatArray * oofem::PrimaryField::giveSolutionVector ( int  i)
protected

Definition at line 449 of file primaryfield.C.

References nHistVectors, OOFEM_ERROR, and solutionVectors.

double oofem::PrimaryField::giveUnknownValue ( Dof dof,
ValueModeType  mode,
TimeStep tStep 
)
virtual
Parameters
dofPointer to DOF.
modeWhat the unknown describes (increment, total value etc.).
tStepTime step of interest.
Returns
Value of interest at given DOF.
Todo:
Clean this up, this is a hack for when we ask for the increment in the first step.

Reimplemented in oofem::DofDistributedPrimaryField.

Definition at line 319 of file primaryfield.C.

References oofem::FloatArray::at(), oofem::Dof::giveEqn(), givePrescribedVector(), giveSolutionVector(), OOFEM_ERROR, oofem::FloatArray::resize(), and resolveIndx().

Referenced by oofem::MasterDof::giveUnknown(), and oofem::CBS::giveUnknownComponent().

void oofem::PrimaryField::initialize ( ValueModeType  mode,
TimeStep tStep,
FloatArray answer,
const UnknownNumberingScheme s 
)
virtual

Copy unknowns from previous solution or DOF's dictionary to the solution vector.

Parameters
modewhat the unknown describes (increment, total value etc.).
tStepTime of interest.
answerResulting vector.

Reimplemented in oofem::DofDistributedPrimaryField.

Definition at line 154 of file primaryfield.C.

References oofem::__ValueModeTypeToString(), giveSolutionVector(), OOFEM_ERROR, resolveIndx(), and oofem::FloatArray::subtract().

void oofem::PrimaryField::readDofManager ( TimeStep tStep,
DofManager dman 
)
void oofem::PrimaryField::readFromDofDictionaries ( TimeStep tStep)
contextIOResultType oofem::PrimaryField::restoreContext ( DataStream stream,
ContextMode  mode 
)
virtual

Restores the receiver state previously written in stream.

Reads the FEMComponent class-id in order to allow test consistency.

Parameters
streamInput stream.
modeDetermines amount of info in stream (state, definition,...).
Returns
contextIOResultType.
Exceptions
Throwsan ContextIOERR exception if error encountered.

Implements oofem::Field.

Reimplemented in oofem::DofDistributedPrimaryField.

Definition at line 541 of file primaryfield.C.

References actualStepIndx, actualStepNumber, oofem::CIO_IOERR, oofem::CIO_OK, emodel, nHistVectors, prescribedVectors, oofem::DataStream::read(), solStepList, solutionVectors, and THROW_CIOERR.

Referenced by oofem::CBS::restoreContext().

contextIOResultType oofem::PrimaryField::saveContext ( DataStream stream,
ContextMode  mode 
)
virtual

Stores receiver state to output stream.

Writes the FEMComponent class-id in order to allow test whether correct data are then restored.

Parameters
streamOutput stream.
modeDetermines amount of info in stream (state, definition,...).
Returns
contextIOResultType.
Exceptions
Throwsan ContextIOERR exception if error encountered.

Implements oofem::Field.

Reimplemented in oofem::DofDistributedPrimaryField.

Definition at line 507 of file primaryfield.C.

References actualStepIndx, actualStepNumber, oofem::CIO_IOERR, oofem::CIO_OK, prescribedVectors, solStepList, solutionVectors, THROW_CIOERR, and oofem::DataStream::write().

Referenced by oofem::CBS::saveContext().

void oofem::PrimaryField::storeDofManager ( TimeStep tStep,
DofManager dman 
)
void oofem::PrimaryField::storeInDofDictionaries ( TimeStep tStep)
void oofem::PrimaryField::update ( ValueModeType  mode,
TimeStep tStep,
const FloatArray vectorToStore,
const UnknownNumberingScheme s 
)
virtual

Project vectorToStore back to DOF's dictionary.

Parameters
vectorToStoreVector with the size of number of equations.
modeMode of the unknown (increment, total value etc.)
tStepTime step unknowns belong to.

Reimplemented in oofem::DofDistributedPrimaryField.

Definition at line 309 of file primaryfield.C.

References oofem::__ValueModeTypeToString(), giveSolutionVector(), and OOFEM_ERROR.

Member Data Documentation

int oofem::PrimaryField::actualStepIndx
protected
int oofem::PrimaryField::actualStepNumber
protected
int oofem::PrimaryField::nHistVectors
protected
std :: vector< FloatArray > oofem::PrimaryField::prescribedVectors
protected
std :: vector< TimeStep > oofem::PrimaryField::solStepList
protected

Definition at line 112 of file primaryfield.h.

Referenced by advanceSolution(), restoreContext(), and saveContext().

std :: vector< FloatArray > oofem::PrimaryField::solutionVectors
protected

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:39 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011