60PrimaryField :: ~PrimaryField()
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));
84PrimaryField :: storeInDofDictionaries(
TimeStep *tStep)
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);
128PrimaryField :: readFromDofDictionaries(
TimeStep *tStep)
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 ) {
163 OOFEM_ERROR(
"unsupported mode %s", __ValueModeTypeToString(mode));
168PrimaryField :: applyDefaultInitialCondition()
184 if ( tStep == NULL ) {
192 for (
auto &dof : *dman ) {
193 int icid = dof->giveIcId();
194 if ( icid > 0 && dof->isPrimaryDof() ) {
198 double val = ic->
give(VM_Total, c);
199 int eq = dof->giveEqn();
200 dof->updateUnknownsDictionary(tStep, VM_Total, val);
203 }
else if ( eq < 0 ) {
238 double tot0 = 0., tot1 = 0.;
240 tot0 = ic.
give(VM_Total, c);
243 tot1 = tot0 - ic.
give(VM_Incremental, c);
250 for (
auto &dof : *dman ) {
251 int eq = dof->giveEqn();
255 }
else if ( eq < 0 ) {
265PrimaryField :: applyBoundaryCondition(
TimeStep *tStep)
270 for (
auto &dof : *dman ) {
271 int peq = - dof->giveEqn();
273 int bcid = dof->giveBcId();
279 for (
auto &bc : d->
giveBcs() ) {
314 if ( mode == VM_Total ) {
317 OOFEM_ERROR(
"unsupported mode %s", __ValueModeTypeToString(mode));
322PrimaryField :: giveUnknownValue(
Dof *dof, ValueModeType mode,
TimeStep *tStep)
326 OOFEM_ERROR(
"invalid equation number (slave dof maybe?)");
329 if ( mode == VM_Total ) {
335 }
else if ( mode == VM_Incremental ) {
353 ValueModeType mode,
TimeStep *tStep,
373 ValueModeType mode,
TimeStep *tStep,
383 if ( bgelem == NULL ) {
396 for (
int i = 1; i <= dofId->
giveSize(); ++i ) {
399 answer.
at(pos) = field.
at(i);
416 return interface->EIPrimaryFieldI_evaluateFieldVectorAt(answer, *
this, coords, * dofId, mode, tStep);
420 return interface->EIPrimaryFieldI_evaluateFieldVectorAt(answer, *
this, coords, elemDofId, mode, tStep);
423 OOFEM_ERROR(
"background element does not support EIPrimaryFiledInterface");
430 ValueModeType mode,
TimeStep *tStep)
432 return this->
__evaluateAt(answer, coords, mode, tStep, NULL);
438 ValueModeType mode,
TimeStep *tStep)
440 return this->
__evaluateAt(answer, dman, mode, tStep, NULL);
451PrimaryField :: giveSolutionVector(
int i)
460PrimaryField :: givePrescribedVector(
int i)
470PrimaryField :: resolveIndx(
TimeStep *tStep,
int shift)
477 OOFEM_ERROR(
"History not available for relative step no. %d to step no. %d (actualStepNumber = %d)", shift, tStepo,
actualStepNumber);
492 OOFEM_ERROR(
"can not advance due to steps skipped");
522 if ( ( iores = vec.storeYourself(stream) ) !=
CIO_OK ) {
528 if ( ( iores = vec.storeYourself(stream) ) !=
CIO_OK ) {
534 step.saveContext(stream);
552 if ( ( iores = vec.restoreYourself(stream) ) !=
CIO_OK ) {
558 if ( ( iores = vec.storeYourself(stream) ) !=
CIO_OK ) {
virtual double give(Dof *dof, ValueModeType mode, TimeStep *tStep)
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.
const FloatArray & giveCoordinates() const
Dof * giveDofWithID(int dofID) const
void giveCompleteUnknownVector(FloatArray &answer, ValueModeType mode, TimeStep *tStep)
void giveUnknownVector(FloatArray &answer, const IntArray &dofMask, ValueModeType mode, TimeStep *tStep, bool padding=false)
SpatialLocalizer * giveSpatialLocalizer()
InitialCondition * giveIc(int n)
std ::vector< std ::unique_ptr< DofManager > > & giveDofManagers()
std ::vector< std ::unique_ptr< GeneralBoundaryCondition > > & giveBcs()
DofManager * giveDofManager(int n)
GeneralBoundaryCondition * giveBc(int n)
std ::vector< std ::unique_ptr< Element > > & giveElements()
virtual void giveElementDofIDMask(IntArray &answer) const
virtual void computeField(ValueModeType mode, TimeStep *tStep, const FloatArray &lcoords, FloatArray &answer)
Domain * giveDomain() const
virtual Interface * giveInterface(InterfaceType t)
Field(FieldType b=FieldType::FT_Unknown)
void zero()
Zeroes all coefficients of receiver.
void subtract(const FloatArray &src)
virtual const IntArray & giveDofIDs() const
int giveSetNumber() const
double give(ValueModeType mode, const FloatArray &coords)
int hasConditionOn(int u)
int findFirstIndexOf(int value) const
int resolveIndx(TimeStep *tStep, int shift)
FloatArray * givePrescribedVector(int)
std ::vector< FloatArray > prescribedVectors
void applyInitialCondition(InitialCondition &ic)
void storeDofManager(TimeStep *tStep, DofManager &dman)
virtual void applyBoundaryCondition(TimeStep *tStep)
virtual int __evaluateAt(FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep, IntArray *dofId)
std ::vector< FloatArray > solutionVectors
std ::vector< TimeStep > solStepList
void readDofManager(TimeStep *tStep, DofManager &dman)
virtual FloatArray * giveSolutionVector(TimeStep *tStep)
const IntArray & giveNodeList()
virtual Element * giveElementContainingPoint(const FloatArray &coords, const IntArray *regionList=nullptr)=0
virtual Element * giveElementClosestToPoint(FloatArray &lcoords, FloatArray &closest, const FloatArray &coords, int region=0)=0
double giveTimeIncrement()
Returns solution step associated time increment.
double giveTargetTime()
Returns target time.
int giveNumber()
Returns receiver's number.
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
FieldType
Physical type of field.
@ EIPrimaryFieldInterfaceType
@ CIO_IOERR
General IO error.