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

#include <uniformgridfield.h>

Inheritance diagram for oofem::UniformGridField:
Collaboration diagram for oofem::UniformGridField:

Public Member Functions

 UniformGridField ()
virtual ~UniformGridField ()
void setGeometry (const FloatArray &lo_, const FloatArray &hi_, const IntArray &div_)
void setValues (const std::vector< FloatArray > &vv)
int evaluateAt (FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep) override
int evaluateAt (FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep) override
const FloatArray nodeValue2d (int i, int j)
const FloatArray nodeValue3d (int i, int j, int k)
void saveContext (DataStream &stream) override
void restoreContext (DataStream &stream) override
const char * giveClassName () const override
Public Member Functions inherited from oofem::Field
 Field (FieldType b=FieldType::FT_Unknown)
virtual ~Field ()
virtual int evaluateAt (FloatArray &answer, Element *elem, ValueModeType mode, TimeStep *tStep)
FieldType giveType ()
 Returns the type of receiver.
void setType (FieldType b)
 Sets the type of receiver.
void setSetsNumbers (const IntArray sets)
 Defines a list of sets used to impose a field on specific elements.
virtual bool hasElementInSets (int nElem, Domain *d)
 Searches if element number exist in IntArray regionSets for given domain.
std::string errorInfo (const char *func) const
 Returns string for prepending output (used by error reporting macros).
virtual void initializeFrom (InputRecord &ir)

Protected Member Functions

void xyz2ijk (const FloatArray &xyz, IntArray &ijk, FloatArray &normXyz) const

Protected Attributes

FloatArray lo
FloatArray hi
IntArray div
std::vector< FloatArrayvalueList
Protected Attributes inherited from oofem::Field
FieldType type
IntArray regionSets

Detailed Description

Field defined by values in uniform grid nodes, with linear interpolation for points inside the grid, or interpolation for the closest point within the grid for points outside.

Definition at line 46 of file uniformgridfield.h.

Constructor & Destructor Documentation

◆ UniformGridField()

oofem::UniformGridField::UniformGridField ( )
inline

Constructor. Creates a field, with unspecified field values.

Definition at line 67 of file uniformgridfield.h.

References oofem::Field::Field().

◆ ~UniformGridField()

virtual oofem::UniformGridField::~UniformGridField ( )
inlinevirtual

Definition at line 68 of file uniformgridfield.h.

Member Function Documentation

◆ evaluateAt() [1/2]

int oofem::UniformGridField::evaluateAt ( FloatArray & answer,
const FloatArray & coords,
ValueModeType mode,
TimeStep * tStep )
overridevirtual

Evaluates the field at given point.

Parameters
coordsCoordinates of the point of interest
answerField evaluated at coordinate.
tStepTime step to evaluate for.
modeMode of value (total, velocity,...).
Returns
Zero if ok, otherwise nonzero.

Implements oofem::Field.

Definition at line 111 of file uniformgridfield.C.

References oofem::FloatArray::giveSize(), oofem::IntArray::giveSize(), nodeValue2d(), nodeValue3d(), OOFEM_ERROR, valueList, xyz2ijk(), and oofem::FloatArray::zero().

Referenced by evaluateAt().

◆ evaluateAt() [2/2]

int oofem::UniformGridField::evaluateAt ( FloatArray & answer,
DofManager * dman,
ValueModeType mode,
TimeStep * tStep )
overridevirtual

Evaluates the field at given DofManager. This potentially can be resolved quickly, as receiver data may be described using values at dofManagers. Here an additional issue exists: one needs to make sure, that passed dman is from the same domain, so that its number can be used to perform suggested quick evaluation.

If this is not the case (the field is described differently), the response can be evaluated using dofman coordinates in a standard way.

Parameters
[out]answerEvaluated field for dman.
dmanReference to dofManager.
modeMode of value (total, velocity,...).
tStepTime step to evaluate for.
Returns
Zero if ok, nonzero Error code (0-ok, 1-failed)

Implements oofem::Field.

Definition at line 165 of file uniformgridfield.C.

References evaluateAt(), and oofem::DofManager::giveCoordinates().

◆ giveClassName()

const char * oofem::UniformGridField::giveClassName ( ) const
inlineoverridevirtual
Returns
Class name of the receiver.

Implements oofem::Field.

Definition at line 88 of file uniformgridfield.h.

◆ nodeValue2d()

const FloatArray oofem::UniformGridField::nodeValue2d ( int i,
int j )

Definition at line 97 of file uniformgridfield.C.

References div, and valueList.

Referenced by evaluateAt().

◆ nodeValue3d()

const FloatArray oofem::UniformGridField::nodeValue3d ( int i,
int j,
int k )

Definition at line 103 of file uniformgridfield.C.

References div, and valueList.

Referenced by evaluateAt().

◆ restoreContext()

void oofem::UniformGridField::restoreContext ( DataStream & stream)
inlineoverridevirtual

Restores the receiver state previously written in stream.

Parameters
streamInput stream.
Exceptions
Throwsan ContextIOERR exception if error encountered.

Implements oofem::Field.

Definition at line 85 of file uniformgridfield.h.

◆ saveContext()

void oofem::UniformGridField::saveContext ( DataStream & stream)
inlineoverridevirtual

Stores receiver state to output stream.

Parameters
streamOutput stream.
Exceptions
Throwsan ContextIOERR exception if error encountered.

Implements oofem::Field.

Definition at line 84 of file uniformgridfield.h.

◆ setGeometry()

void oofem::UniformGridField::setGeometry ( const FloatArray & lo_,
const FloatArray & hi_,
const IntArray & div_ )

Shorthand for defining geometry, with consistency checks. Used primarily from python

Definition at line 65 of file uniformgridfield.C.

References oofem::IntArray::at(), div, oofem::FloatArray::giveSize(), oofem::IntArray::giveSize(), hi, lo, OOFEM_ERROR, and valueList.

◆ setValues()

void oofem::UniformGridField::setValues ( const std::vector< FloatArray > & vv)

Accessor for setting nodal values; checks size of the array for correctness.

Definition at line 86 of file uniformgridfield.C.

References div, and valueList.

◆ xyz2ijk()

void oofem::UniformGridField::xyz2ijk ( const FloatArray & xyz,
IntArray & ijk,
FloatArray & normXyz ) const
protected

Member Data Documentation

◆ div

IntArray oofem::UniformGridField::div
protected

Definition at line 53 of file uniformgridfield.h.

Referenced by nodeValue2d(), nodeValue3d(), setGeometry(), setValues(), and xyz2ijk().

◆ hi

FloatArray oofem::UniformGridField::hi
protected

Definition at line 51 of file uniformgridfield.h.

Referenced by setGeometry(), and xyz2ijk().

◆ lo

FloatArray oofem::UniformGridField::lo
protected

Definition at line 50 of file uniformgridfield.h.

Referenced by setGeometry(), and xyz2ijk().

◆ valueList

std::vector< FloatArray > oofem::UniformGridField::valueList
protected

Definition at line 56 of file uniformgridfield.h.

Referenced by evaluateAt(), nodeValue2d(), nodeValue3d(), setGeometry(), and setValues().


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