56 auto it = valDict.find(
"x");
57 if ( it == valDict.end() ) {
58 OOFEM_ERROR(
"Coordinate needed for evaluating function");
60 const FloatArray &globalCoordinates = it->second.val1;
62 int countXDown = 0, countXUp = 0, countYDown = 0, countYUp = 0;
63 double randomVariable = 0.;
65 double helpX = 0., helpY = 0.;
66 int i = 0, exitFlag = 0;
69 double randomXStart =
field(0);
71 double randomYStart =
field(1);
74 if ( !( globalCoordinates.
at(1) > randomXStart && globalCoordinates.
at(1) < randomXEnd &&
75 globalCoordinates.
at(2) > randomYStart && globalCoordinates.
at(2) < randomYEnd ) ) {
79 while ( exitFlag == 0 ) {
99 while ( exitFlag == 0 ) {
100 if (
field(3 * i + 1) > globalCoordinates.
at(2) ) {
110 helpY = ( globalCoordinates.
at(2) -
field(3 * countYDown + 1) )
111 / (
field(3 * countYUp + 1) -
field(3 * countYDown + 1) );
118 if ( randomVariable == 0. ) {
120 ( 1. - helpX ) * ( 1. - helpY ) *
field(3 * ( countXDown *
numberReal(1) + countYDown ) + 2) +
121 helpX * ( 1. - helpY ) *
field(3 * ( countXUp *
numberReal(1) + countYDown ) + 2) +
122 helpX *helpY *
field(3 * ( countXUp *
numberReal ( 1 ) + countYUp ) + 2) +
123 ( 1. - helpX ) * helpY *
field(3 * ( countXDown *
numberReal(1) + countYUp ) + 2);
127 if ( randomVariable <= 0. ) {
128 randomVariable = 1.e-8;
137 OOFEM_ERROR(
"InterpolatingFunction needs coordinates to evaluate.");
151 std :: ifstream inputField( name.c_str() );
153 if ( !inputField.is_open() ) {
158 double deltaX, deltaY;
virtual ~InterpolatingFuction()
Destructor.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
void zero()
Sets all component to zero.
double & at(int i)
Coefficient access function.
REGISTER_Function(CalculatorFunction)
virtual void evaluate(FloatArray &answer, const std::map< std::string, FunctionArgument > &valDict, GaussPoint *gp=NULL, double param=0.)
Returns the value of the function for given input.
void resize(int n)
Checks size of receiver towards requested bounds.
InterpolatingFuction(int n, Domain *d)
Constructor.
Class representing vector of real numbers.
virtual double evaluateAtTime(double t)
Returns the value of the function at given time.
Abstract base class representing a function with vector input and output.
IRResultType
Type defining the return values of InputRecord reading operations.
void zero()
Zeroes all coefficients of receiver.
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define _IFT_InterpolatingFuction_filename
Class representing integration point in finite element program.
#define OOFEM_WARNING(...)
void resize(int s)
Resizes receiver towards requested size.