20 #ifndef GEOS_FUNCTIONS_FUNCTIONBASE_HPP_ 
   21 #define GEOS_FUNCTIONS_FUNCTIONBASE_HPP_ 
   26 #include "common/GEOS_RAJA_Interface.hpp" 
   31 namespace dataRepository
 
  164   template< 
typename LEAF, 
typename POLICY = serialPolicy >
 
  174 template< 
typename LEAF, 
typename POLICY >
 
  186   for( 
integer varIndex = 0; varIndex < numVars; ++varIndex )
 
  190     if( varName == 
"time" )
 
  192       inputPtrs[varIndex] = &time;
 
  193       varSize[varIndex] = 1;
 
  203         using ArrayType = camp::first< decltype( tupleOfTypes ) >;
 
  205         view.move( hostMemorySpace, 
false );
 
  206         for( 
int dim = 0; dim < ArrayType::NDIM; ++dim )
 
  208           varStride[varIndex][dim] = view.strides()[dim];
 
  210         inputPtrs[varIndex] = view.data();
 
  213     totalVarSize += varSize[varIndex];
 
  220                         getDataContext() << 
": Insufficient number of  scale values provided" );
 
  224                         getDataContext() << 
": To apply a function to a set, the size of the result and set must match" );
 
  229     localIndex const index = set[i];
 
  230     real64 input[MAX_VARS]{};
 
  232     for( 
integer varIndex = 0; varIndex < numVars; ++varIndex )
 
  234       for( localIndex compIndex = 0; compIndex < varSize[varIndex]; ++compIndex, ++inputIndex )
 
  236         localIndex const varOffset = index * varStride[varIndex][0] + compIndex * varStride[varIndex][1];
 
  237         input[inputIndex] = ( inputPtrs[varIndex][varOffset] ) * scale[inputIndex];
 
  240     result[i] = 
static_cast< LEAF 
const * 
>( this )->evaluate( input );
 
string const inputVarNames("inputVarNames")
The key for inputVarNames.
 
#define GEOS_ERROR_IF_GT_MSG(lhs, rhs, msg)
Raise a hard error if one value compares greater than the other.
 
#define GEOS_ERROR_IF_NE_MSG(lhs, rhs, msg)
Raise a hard error if two values are not equal.
 
static string const  & getOutputDirectory()
Get the output directory for function output.
 
void evaluateT(dataRepository::Group const &group, real64 const time, SortedArrayView< localIndex const > const &set, arrayView1d< real64 > const &result) const
Method to apply an function with an arbitrary type of output.
 
virtual ~FunctionBase() override=default
destructor
 
real64_array evaluateStats(dataRepository::Group const &group, real64 const time, SortedArray< localIndex > const &set) const
This generates statistics by applying a function to an object.
 
FunctionBase(const string &name, dataRepository::Group *const parent)
Constructor.
 
static void setOutputDirectory(string const &outputDir)
Set the output directory for function output.
 
static constexpr int MAX_VARS
Maximum total number of independent variables (including components of multidimensional variables)
 
static CatalogInterface::CatalogType & getCatalog()
return the catalog entry for the function
 
array1d< real64 > m_inputVarScale
scaling for input variables
 
string_array m_inputVarNames
names for the input variables
 
virtual void initializeFunction()=0
Function initialization.
 
void setInputVarNames(string_array inputVarNames)
Set the input variable names.
 
virtual void postInputInitialization() override
 
integer isFunctionOfTime() const
Test to see if the function is a 1D function of time.
 
virtual real64 evaluate(real64 const *const input) const =0
Method to evaluate a function.
 
virtual void evaluate(dataRepository::Group const &group, real64 const time, SortedArrayView< localIndex const > const &set, arrayView1d< real64 > const &result) const =0
Method to evaluate a function on a target object.
 
This class provides the base class/interface for the catalog value objects.
 
std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType
This is the type that will be used for the catalog. The catalog is actually instantiated in the BASET...
 
DataContext const  & getDataContext() const
 
WrapperBase const  & getWrapperBase(KEY const &key) const
Return a reference to a WrapperBase stored in this group.
 
Base class for all wrappers containing common operations.
 
virtual localIndex numArrayComp() const =0
Return the number of components in a multidimensional array.
 
static Wrapper & cast(WrapperBase &wrapper)
Downcast base to a typed wrapper.
 
T & reference()
Accessor for m_data.
 
DimsRange< 1, N > DimsUpTo
Generate a list of types representing array dimensionalities up to (and including) N.
 
bool dispatch(LIST const combinations, LAMBDA &&lambda, Ts &&... objects)
Dispatch a generic worker function lambda based on runtime type.
 
internal::Apply< camp::list, LIST > ListofTypeList
Construct a list of list type.
 
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
 
stdVector< string > string_array
A 1-dimensional array of geos::string types.
 
std::set< T > set
A set of local indices.
 
double real64
64-bit floating point type.
 
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
 
array1d< real64 > real64_array
A 1-dimensional array of geos::real64 types.
 
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
 
LvArray::SortedArrayView< T, localIndex, LvArray::ChaiBuffer > SortedArrayView
A sorted array view of local indices.
 
int integer
Signed integer type.
 
Array< T, 1 > array1d
Alias for 1D array.
 
static constexpr char const  * inputVarScaleString()
 
static constexpr char const  * inputVarNamesString()