54 for(
int ax=0; ax<xyz.
giveSize(); ax++){
56 double cellDim=(
hi[ax]-
lo[ax])/
div[ax];
57 double t=(xyz[ax]-
lo[ax])/cellDim;
59 if(t>=
div[ax]){ ijk[ax]=
div[ax]-1; normXyz[ax]=1.; }
60 else if(t<0) { ijk[ax]=0; normXyz[ax]=0.; }
61 else { ijk[ax]=(int)std::floor(t); normXyz[ax]=t-ijk[ax]; }
71 if(lo_[i]>=hi_[i])
OOFEM_ERROR(
"lo must be strictly smaller than hi along all axes.");
72 if(div_[i]<1)
OOFEM_ERROR(
"div must be at least 1 along all axes.")
78 this->precomputeInternal();
84 if(vv.
giveSize()!=s)
OOFEM_ERROR((std::string(
"Array size must be exactly prod(div[i]+1)=")+std::to_string(s)).c_str());
106 double& ret(answer[0]);
111 this->
xyz2ijk(coords,ijk,normXyz);
115 const int& i(ijk[0]);
const int& j(ijk[1]);
const int& k(ijk[2]);
116 int I(i+1), J(j+1), K(k+1);
117 const double& x(normXyz[0]);
const double& y(normXyz[1]);
const double& z(normXyz[2]);
118 double X(1-x), Y(1-y), Z(1-z);
120 X*Y*Z,x*Y*Z,x*y*Z,X*y*Z,
121 X*Y*z,x*Y*z,x*y*z,X*y*z
124 {i,j,k},{I,j,k},{I,J,k},{i,J,k},
125 {i,j,K},{I,j,K},{I,J,K},{i,J,K}
127 assert(abs(weights[0]+weights[1]+weights[2]+weights[3]+weights[4]+weights[5]+weights[6]+weights[7]-1) < 1e-5);
128 for(
int p=0; p<8; p++){
130 ret+=weights[p]*this->
nodeValue3d(pts[p][0],pts[p][1],pts[p][2]);
135 const int& i(ijk[0]);
const int& j(ijk[1]);
int I(i+1);
int J(j+1);
136 const double& x(normXyz[0]);
const double y(normXyz[1]);
double X(1-x);
double Y(1-y);
137 double weights[]={X*Y,x*Y,X*y,x*y};
138 int pts[][2]={{i,j},{I,j},{i,J},{I,J}};
139 assert(abs(weights[0]+weights[1]+weights[2]+weights[3]-1)<1e-5);
140 for(
int p=0; p<4; p++){
142 ret+=weights[p]*this->
nodeValue2d(pts[p][0],pts[p][1]);
147 OOFEM_ERROR((std::string(
"UniformGridField::evaluateAt: erroneous dimension of input coordinates (")+std::to_string(coords.
giveSize())+
", must be 2 or 3).").c_str());
161 return ( result == 1 );
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
virtual FloatArray * giveCoordinates()
Base class for dof managers.
Class implementing an array of integers.
virtual bool hasCoordinates()
void resize(int n)
Checks size of receiver towards requested bounds.
Class representing vector of real numbers.
int giveSize() const
Returns the size of receiver.
the oofem namespace is to define a context or scope in which all oofem names are defined.
Class representing solution step.
void resize(int s)
Resizes receiver towards requested size.