50 FieldType ft,
int nHist) :
Field(ft), solutionVectors(nHist + 1), prescribedVectors(nHist + 1), solStepList(nHist + 1, a)
67 for (
Dof *dof: dman ) {
68 int eq = dof->giveEqn();
70 for (
int hist = 0; hist < this->
nHistVectors; ++hist ) {
73 dof->updateUnknownsDictionary(step, VM_Total, vec->
at(eq));
74 }
else if ( eq < 0 ) {
76 dof->updateUnknownsDictionary(step, VM_Total, vec->
at(-eq));
92 int ndman = elem->giveNumberOfInternalDofManagers();
93 for (
int i = 1; i <= ndman; i++ ) {
98 for (
auto &bc : d->
giveBcs() ) {
99 int ndman = bc->giveNumberOfInternalDofManagers();
100 for (
int i = 1; i <= ndman; i++ ) {
110 for (
Dof *dof: dman ) {
111 int eq = dof->giveEqn();
113 for (
int hist = 0; hist < this->
nHistVectors; ++hist ) {
116 vec->
at(eq) = dof->giveUnknownsDictionaryValue(step, VM_Total);
117 }
else if ( eq < 0 ) {
119 vec->
at(-eq) = dof->giveUnknownsDictionaryValue(step, VM_Total);
138 int ndman = elem->giveNumberOfInternalDofManagers();
139 for (
int i = 1; i <= ndman; i++ ) {
144 for (
auto &bc : d->
giveBcs() ) {
145 int ndman = bc->giveNumberOfInternalDofManagers();
146 for (
int i = 1; i <= ndman; i++ ) {
156 if ( mode == VM_Total ) {
158 }
else if ( mode == VM_Incremental ) {
184 if ( tStep == NULL ) {
192 for (
auto &dof : *dman ) {
193 int icid = dof->giveIcId();
194 if ( icid > 0 && dof->isPrimaryDof() ) {
197 double val = ic->
give(VM_Total);
198 int eq = dof->giveEqn();
199 dof->updateUnknownsDictionary(tStep, VM_Total, val);
202 }
else if ( eq < 0 ) {
234 for (
int inode : set->giveNodeList() ) {
236 double tot0 = 0., tot1 = 0.;
238 tot0 = ic.
give(VM_Total);
241 tot1 = tot0 - ic.
give(VM_Incremental);
247 for (
auto &dof : *dman ) {
248 int eq = dof->giveEqn();
252 }
else if ( eq < 0 ) {
267 for (
auto &dof : *dman ) {
268 int peq = - dof->giveEqn();
270 int bcid = dof->giveBcId();
276 for (
auto &bc : d->
giveBcs() ) {
295 for (
int inode : set->giveNodeList() ) {
311 if ( mode == VM_Total ) {
323 OOFEM_ERROR(
"invalid equation number (slave dof maybe?)");
326 if ( mode == VM_Total ) {
332 }
else if ( mode == VM_Incremental ) {
380 if ( bgelem == NULL ) {
393 for (
int i = 1; i <= dofId->
giveSize(); ++i ) {
396 answer.
at(pos) = field.
at(i);
417 return interface->EIPrimaryFieldI_evaluateFieldVectorAt(answer, *
this, coords, elemDofId, mode, tStep);
420 OOFEM_ERROR(
"background element does not support EIPrimaryFiledInterface");
430 return this->
__evaluateAt(answer, coords, mode, tStep, NULL);
438 return this->
__evaluateAt(answer, dman, mode, tStep, NULL);
475 OOFEM_ERROR(
"History not available for relative step no. %d to step no. %d (actualStepNumber = %d)", shift, tStepo,
actualStepNumber);
490 OOFEM_ERROR(
"can not advance due to steps skipped");
520 if ( ( iores = vec.storeYourself(stream) ) !=
CIO_OK ) {
526 if ( ( iores = vec.storeYourself(stream) ) !=
CIO_OK ) {
532 if ( ( iores = step.saveContext(stream, mode) ) !=
CIO_OK ) {
554 if ( ( iores = vec.restoreYourself(stream) ) !=
CIO_OK ) {
560 if ( ( iores = vec.storeYourself(stream) ) !=
CIO_OK ) {
virtual FloatArray * giveSolutionVector(TimeStep *tStep)
The base class for all spatial localizers.
The representation of EngngModel default unknown numbering.
void readFromDofDictionaries(TimeStep *tStep)
void subtract(const FloatArray &src)
Subtracts array src to receiver.
virtual void advanceSolution(TimeStep *tStep)
Brings up a new solution vector for given time step.
void readDofManager(TimeStep *tStep, DofManager &dman)
virtual int giveNumberOfDomainEquations(int di, const UnknownNumberingScheme &num)
Returns number of equations for given domain in active (current time step) time step.
FieldType
Physical type of field.
Class implementing general initial condition.
InitialCondition * giveIc(int n)
Service for accessing particular domain ic.
virtual double give(Dof *dof, ValueModeType mode, TimeStep *tStep)
Returns the value of a prescribed unknown, respecting requested mode for given time.
virtual int EIPrimaryFieldI_evaluateFieldVectorAt(FloatArray &answer, PrimaryField &pf, const FloatArray &coords, IntArray &dofId, ValueModeType mode, TimeStep *tStep)=0
Evaluates the value of field at given point of interest (should be located inside receiver's volume) ...
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
double & at(int i)
Coefficient access function.
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
virtual const IntArray & giveDofIDs() const
Array with default dofs which b.c.
virtual int giveEqn()
Gives number for equation, negative for prescribed equations.
PrimaryField(EngngModel *a, int idomain, FieldType ft, int nHist)
Constructor.
virtual FloatArray * giveCoordinates()
double giveTargetTime()
Returns target time.
Abstract base class for all finite elements.
Base class for dof managers.
std::vector< std::unique_ptr< DofManager > > & giveDofManagers()
int resolveIndx(TimeStep *tStep, int shift)
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.
std::vector< TimeStep > solStepList
Abstract class representing field.
GeneralBoundaryCondition * giveBc(int n)
Service for accessing particular domain bc.
double giveTimeIncrement()
Returns solution step associated time increment.
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
std::vector< std::unique_ptr< GeneralBoundaryCondition > > & giveBcs()
FloatArray * givePrescribedVector(int)
int giveSetNumber()
Gives the set number which boundary condition is applied to.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores receiver state to output stream.
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.
Class implementing Dirichlet boundary condition on DOF (primary boundary condition).
int giveNumber()
Returns receiver's number.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode)
Restores the receiver state previously written in stream.
int hasConditionOn(int u)
Tests if receiver has initial condition for specific unknown-mode.
virtual void applyBoundaryCondition(TimeStep *tStep)
Applies all boundary conditions to all prescribed DOFs.
Set of elements, boundaries, edges and/or nodes.
SpatialLocalizer * giveSpatialLocalizer()
Returns receiver's associated spatial localizer.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
void storeDofManager(TimeStep *tStep, DofManager &dman)
void applyInitialCondition(InitialCondition &ic)
Applies initial condition to all DOFs.
Set * giveSet(int n)
Service for accessing particular domain set.
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.
std::vector< std::unique_ptr< InitialCondition > > & giveIcs()
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.
virtual void giveElementDofIDMask(IntArray &answer) const
Returns element dof mask for node.
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
virtual Element * giveElementContainingPoint(const FloatArray &coords, const IntArray *regionList=NULL)=0
Returns the element, containing given point and belonging to one of the region in region list...
double give(ValueModeType mode)
Returns value of initial condition for given unknown mode (determines whether total or velocity or ac...
void giveCompleteUnknownVector(FloatArray &answer, ValueModeType mode, TimeStep *tStep)
Assembles the complete unknown vector in node.
Class representing vector of real numbers.
virtual Element * giveElementClosestToPoint(FloatArray &lcoords, FloatArray &closest, const FloatArray &coords, int region=0)=0
Returns the element closest to a given point.
The representation of EngngModel default prescribed unknown numbering.
std::vector< FloatArray > prescribedVectors
void storeInDofDictionaries(TimeStep *tStep)
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
void zero()
Zeroes all coefficients of receiver.
virtual Interface * giveInterface(InterfaceType t)
Interface requesting service.
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
int giveSetNumber()
Gives the set number which initial condition is applied to.
Domain * giveDomain() const
virtual TimeStep * giveSolutionStepWhenIcApply(bool force=false)
Returns the solution step when Initial Conditions (IC) apply.
std::vector< std::unique_ptr< Element > > & giveElements()
Abstract base class representing the "problem" under consideration.
virtual void computeField(ValueModeType mode, TimeStep *tStep, const FloatArray &lcoords, FloatArray &answer)
Computes the unknown vector interpolated at the specified local coordinates.
the oofem namespace is to define a context or scope in which all oofem names are defined.
Domain * giveDomain(int n)
Service for accessing particular problem domain.
Abstract class Dof represents Degree Of Freedom in finite element mesh.
std::vector< FloatArray > solutionVectors
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
virtual void applyDefaultInitialCondition()
Applies the default initial values values for all DOFs (0) in given domain.
Class representing solution step.
virtual double giveUnknownValue(Dof *dof, ValueModeType mode, TimeStep *tStep)
int findFirstIndexOf(int value) const
Finds index of first occurrence of given value in array.
virtual int evaluateAt(FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep)
Evaluates the field at given point.
virtual void update(ValueModeType mode, TimeStep *tStep, const FloatArray &vectorToStore, const UnknownNumberingScheme &s)
Project vectorToStore back to DOF's dictionary.
const char * __ValueModeTypeToString(ValueModeType _value)
void resize(int s)
Resizes receiver towards requested size.