1#ifndef __FIBER_FIELD_COMPUTATIONAL_FIELD_HPP
2#define __FIBER_FIELD_COMPUTATIONAL_FIELD_HPP
5#include "OnDemandCreator.hpp"
65template <
class FieldOperator>
82 :
Field( InputField->getFragmentIDCollection() )
99 :
Field( InputField.getFragmentIDCollection() )
106 using primary_value_type =
typename FieldOperator::primary_value_type;
107 using result_type =
typename FieldOperator::result_type;
135 template <Dims_t Dims>
145 assert( Params.myComputationalField );
146 assert( Params.myInputFieldFragment );
154 if (Params.myComputationalField->computeFragment( *OutputData, *InputData, Params.myFragmentID) )
156 result_storage = OutputData;
163 return result_storage;
178 if (!CAB)
return true;
182 if ( getFragmentIDCollection()
and getFragmentIDCollection() !=
fid->getFragmentIDCollection() )
183 Verbose(0) <<
" ComputationalField::setCreator() - MISMATCH in fragment ID collection! ";
185 Assert( getFragmentIDCollection() ==
fid->getFragmentIDCollection() );
192 if (
MAP.myElementType() !=
typeid(primary_value_type) )
206 else if (
pMAP->rank==2)
213 else if (
pMAP->rank==1)
222 Assert(0 &&
"Computational Field attempted on field with unsupported mem array rank on its creators");
227 Assert(0 &&
"Computational Field attempted on field without mem array properties on its creators");
248 Assert( getFragmentIDCollection() ==
SourceData.getFragmentIDCollection() );
252 return apply(FragID, CAB);
265template <
class FieldOperator>
278template <
class FieldOperator>
280 const Field&InputField,
A field which contains computational operations that are executed on demand per fragment.
Definition ComputationalField.hpp:67
ComputationalField(const FieldOperator &FO, const Field &InputField, const MemCore::RefPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
The Constructor wants an instance of the associated field operator and the primary input field.
Definition ComputationalField.hpp:97
MemCore::RefPtr< MemCore::Cache > myCache
Reference to the cache object managing the memory occupied by the resulting data.
Definition ComputationalField.hpp:73
ComputationalField(const FieldOperator &FO, const RefPtr< Field > &InputField, const MemCore::RefPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
The Constructor wants an instance of the associated field operator and the primary input field.
Definition ComputationalField.hpp:80
int createFieldFragments(const Field &SourceData)
Create the fragments of this field, usually not to be called explicitly.
Definition ComputationalField.hpp:245
bool apply(const RefPtr< FragmentID > &fid, const RefPtr< CreativeArrayBase > &CAB)
The fragment iteration callback function.
Definition ComputationalField.hpp:176
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
const RefPtr< CreativeArrayBase > & setCreator(const RefPtr< CreativeArrayBase > &FFC, const RefPtr< FragmentID > &=nullptr)
Sets the creator for an unfragmented field.
Definition Field.cpp:433
Interface class to provide information about multidimensional arrays without need to create the data ...
Definition MemArrayProperties.hpp:28
A Creator object that allows to create data on demand, when they are used and accessed.
Definition OnDemandCreator.hpp:65
static RefPtr< Cache, CacheBase > & MemCache()
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
ComputationalField< FieldOperator > * newComputationalField(const FieldOperator &FO, const RefPtr< Field > &InputField, const MemCore::RefPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
A convenience template function to construct a computational field (class ComputationalField) from an...
Definition ComputationalField.hpp:266
Internal helper class to pass parameters from the computational field class to the on-demand creators...
Definition ComputationalField.hpp:114
Internal helper class which calls the computeFragment() member function of the associated FieldOperat...
Definition ComputationalField.hpp:137