Phalanx  Development
 All Classes Functions Variables Typedefs Enumerations Friends Pages
Public Types | Public Member Functions | List of all members
PHX::FieldManager< Traits > Class Template Reference

Public Types

typedef
PHX::EvaluationContainer_TemplateManager
< Traits >::iterator 
iterator
 

Public Member Functions

void requireFieldForAllEvaluationTypes (const PHX::FieldTag &t)
 
template<typename EvalT >
void requireField (const PHX::FieldTag &t)
 
void registerEvaluatorForAllEvaluationTypes (const Teuchos::RCP< PHX::Evaluator< Traits > > &e)
 
template<typename EvalT >
void registerEvaluator (const Teuchos::RCP< PHX::Evaluator< Traits > > &e)
 
void registerEvaluator (typename PHX::FieldManager< Traits >::iterator it, const Teuchos::RCP< PHX::Evaluator< Traits > > &e)
 
template<typename EvalT , typename DataT , typename... Props>
void getFieldData (PHX::MDField< DataT, Props...> &f)
 
template<typename EvalT , typename DataT , typename... Props>
void getFieldData (PHX::MDField< const DataT, Props...> &f)
 
template<typename EvalT , typename DataT , int Rank, typename Layout >
void getFieldData (PHX::Field< DataT, Rank, Layout > &f)
 
template<typename EvalT , typename DataT , int Rank, typename Layout >
void getFieldData (PHX::Field< const DataT, Rank, Layout > &f)
 
template<typename EvalT , typename DataT , typename Layout >
void getFieldData (const PHX::FieldTag &ft, Kokkos::View< DataT, Layout, PHX::Device > &f)
 
template<typename EvalT , typename DataT , typename... Props>
void setUnmanagedField (PHX::MDField< DataT, Props...> &f, const bool cleanup_output=true)
 Allows the user to manage the memory allocation of a particular field and dynamically set/swap the memory at any time. More...
 
template<typename EvalT , typename DataT , int Rank, typename Layout >
void setUnmanagedField (PHX::Field< DataT, Rank, Layout > &f, const bool cleanup_output=true)
 Allows the user to manage the memory allocation of a particular field and dynamically set/swap the memory at any time. More...
 
template<typename EvalT , typename DataT , typename Layout >
void setUnmanagedField (const FieldTag &ft, Kokkos::View< DataT, Layout, PHX::Device > &f, const bool cleanup_ouput=true)
 Allows the user to manage the memory allocation of a particular field and dynamically set/swap the memory at any time. More...
 
void aliasFieldForAllEvaluationTypes (const PHX::FieldTag &aliasedField, const PHX::FieldTag &targetField)
 Makes two fields point to (alias) the same memory for all evaluation types. More...
 
template<typename EvalT >
void aliasField (const PHX::FieldTag &aliasedField, const PHX::FieldTag &targetField)
 Makes two fields point to (alias) the same memory for a specific evaluation type. More...
 
template<typename EvalT >
void postRegistrationSetupForType (typename Traits::SetupData d, const bool &buildDeviceDAG=false, const bool &minimizeDAGMemoryUse=false, const PHX::MemoryManager *const memoryManager=nullptr)
 Builds DAG (if not already built) and allocates memory for a single evaluation type. More...
 
void postRegistrationSetup (typename Traits::SetupData d, const bool &buildDeviceDAG=false, const bool &minimizeDAGMemoryUse=false, const PHX::MemoryManager *const memoryManager=nullptr)
 Builds DAG (if not already built) and allocates memory for all evaluation types. More...
 
template<typename EvalT >
void evaluateFields (typename Traits::EvalData d)
 Evalaute fields with a separate parallel_for for each node in the DAG.
 
template<typename EvalT >
void evaluateFieldsDeviceDag (const int &work_size, const int &team_size, const int &vector_size, typename Traits::EvalData d)
 Evalaute fields using Device DAG capability where a single parallel_for evaluates the entire DAG.
 
template<typename EvalT >
void preEvaluate (typename Traits::PreEvalData d)
 
template<typename EvalT >
void postEvaluate (typename Traits::PostEvalData d)
 
template<typename EvalT >
void setKokkosExtendedDataTypeDimensions (const std::vector< PHX::index_size_type > &dims)
 
template<typename EvalT >
const std::vector
< PHX::index_size_type > & 
getKokkosExtendedDataTypeDimensions () const
 
FieldManager::iterator begin ()
 Return iterator to first EvaluationContainer.
 
FieldManager::iterator end ()
 Return iterator to last EvaluationContainer.
 
template<typename EvalT >
void writeGraphvizFile (const std::string filename="graph.dot", bool writeEvaluatedFields=true, bool writeDependentFields=true, bool debugRegisteredEvaluators=false) const
 Writes graphviz dot file for the evaluation type.
 
void writeGraphvizFile (const std::string base_filename="graph", const std::string file_extension=".dot", bool writeEvaluatedFields=true, bool writeDependentFields=true, bool debugRegisteredEvaluators=false) const
 Writes graphviz dot file for all evaluation types (adds eval type to filename).
 
void print (std::ostream &os) const
 
template<typename EvalT >
void analyzeGraph (double &speedup, double &parallelizability) const
 
template<typename EvalT >
void buildDagForType ()
 
template<typename EvalT >
const std::vector
< Teuchos::RCP< PHX::FieldTag > > & 
getFieldTagsForSizing ()
 
template<typename EvalT >
void printEvaluatorStartStopMessage (const Teuchos::RCP< std::ostream > &ostr)
 Print to user specified ostream when each evaluator starts and stops. Useful for debugging. Enabled only in debug builds. More...
 
template<typename Traits>
void registerEvaluator (FieldManager::iterator it, const Teuchos::RCP< PHX::Evaluator< Traits > > &e)
 

Member Function Documentation

template<typename Traits >
template<typename EvalT >
void PHX::FieldManager< Traits >::aliasField ( const PHX::FieldTag aliasedField,
const PHX::FieldTag targetField 
)

Makes two fields point to (alias) the same memory for a specific evaluation type.

WARNING: this is a very dangerous power user capability. This allows users to tell the FieldManager to create a new field that points to the same underlying memory as another field. The user must be sure that the DataLayouts and Scalar types are the same. Only use this BEFORE postRegistrationSetup() is called. This injects extra dependencies that must be accounted for during DAG construction.

This is intended for the use case where a user wants to reuse an evaluator with hard coded field names but would like to rename the evaluated fields without adding naming logic to the evaluator.

Parameters
aliasedFieldField that is aliased to the target field's memory
targetFieldField whos memory is pointed to by the aliased field
template<typename Traits >
void PHX::FieldManager< Traits >::aliasFieldForAllEvaluationTypes ( const PHX::FieldTag aliasedField,
const PHX::FieldTag targetField 
)

Makes two fields point to (alias) the same memory for all evaluation types.

WARNING: this is a very dangerous power user capability. This allows users to tell the FieldManager to create a new field that points to the same underlying memory as another field. The user must be sure that the DataLayouts and Scalar types are the same. Only use this BEFORE postRegistrationSetup() is called. This injects extra dependencies that must be accounted for during DAG construction.

This is intended for the use case where a user wants to reuse an evaluator with hard coded field names but would like to rename the evaluated fields without adding naming logic to the evaluator.

Parameters
aliasedFieldField that is aliased to the target field's memory
targetFieldField whos memory is pointed to by the aliased field
template<typename Traits >
template<typename EvalT >
void PHX::FieldManager< Traits >::buildDagForType ( )

Builds the DAG for the evalaution type. This should only be called after all evaluators are registered and all required fields are requested. This method is for power users only. This is automatically called during postRegistrationSetup() and normally does not have to be called by the users. This method allows users to build the DAG but then perform other activities prior to allocating the fields. An example use case is to delay the sizing of the fields in the DataLayouts until right before allocation. The user could create the dag and access a list of required fields and then do sizing based on information aboutrequired fields.

template<typename Traits >
template<typename EvalT >
const std::vector< Teuchos::RCP< PHX::FieldTag > > & PHX::FieldManager< Traits >::getFieldTagsForSizing ( )

Returns the FieldTags for all fields involved in the evaluation. Will return an empty vector unless the user has built the DAG using one of the following calls: postRegistrationSetup(), postRegistrationSetupForType() or buildDagForType().

WARNING: This is a dangerous power user feature. It returns non-const field tags so that the fields can be sized after the DAG has been created.

template<typename Traits>
void PHX::FieldManager< Traits >::postRegistrationSetup ( typename Traits::SetupData  d,
const bool &  buildDeviceDAG = false,
const bool &  minimizeDAGMemoryUse = false,
const PHX::MemoryManager *const  memoryManager = nullptr 
)
inline

Builds DAG (if not already built) and allocates memory for all evaluation types.

Parameters
[in]dUser defined setup data.
[in]buildDeviceDAG(optional) If set to true, the dag is built on device.
[in]minimizeDAGMemoryUse(optional) If set to true, field memory will be reused in a DAG by binding the same kokkos allocation trackers to non-overlapping fields when possible.
[in]memoryManager(optional) If non-null, field memory allocations will use the memoryManager. This can allow multiple DAGs within a FieldManager and multiple FieldManagers to share/reuse field memory.
template<typename Traits>
template<typename EvalT >
void PHX::FieldManager< Traits >::postRegistrationSetupForType ( typename Traits::SetupData  d,
const bool &  buildDeviceDAG = false,
const bool &  minimizeDAGMemoryUse = false,
const PHX::MemoryManager *const  memoryManager = nullptr 
)
inline

Builds DAG (if not already built) and allocates memory for a single evaluation type.

Parameters
[in]dUser defined setup data.
[in]buildDeviceDAG(optional) If set to true, the dag is built on device.
[in]minimizeDAGMemoryUse(optional) If set to true, field memory will be reused in a DAG by binding the same kokkos allocation trackers to non-overlapping fields when possible.
[in]memoryManager(optional) If non-null, field memory allocations will use the memoryManager. This can allow multiple DAGs within a FieldManager and multiple FieldManagers to share/reuse field memory.
template<typename Traits >
template<typename EvalT >
void PHX::FieldManager< Traits >::printEvaluatorStartStopMessage ( const Teuchos::RCP< std::ostream > &  ostr)

Print to user specified ostream when each evaluator starts and stops. Useful for debugging. Enabled only in debug builds.

Parameters
[in]ostrRCP to output stream. If set to null, this disables printing.
template<typename Traits >
template<typename EvalT , typename DataT , typename... Props>
void PHX::FieldManager< Traits >::setUnmanagedField ( PHX::MDField< DataT, Props...> &  f,
const bool  cleanup_output = true 
)
inline

Allows the user to manage the memory allocation of a particular field and dynamically set/swap the memory at any time.

This overrides the field allocated to this array in the FieldManager. The fieldManager then sets this new memory pointer in all evaluator fields that use it.

NOTE: this is a very dangerous power user capability as the user must allocate the field correctly (remember Sacado AD types must have the extra dimensions sized correctly).

Parameters
cleanup_output(bool) This flag only matters if this function is called after postRegistrationSetup() is called. If set to true and called after postRegistrationSetup(), this will take more execution time to search field lists to cleanup data structures for output information. This is important because a user could toggle a field that was tagged as shared during postRegistrationSetup() into an unmanaged state. The code will always perform correctly, but output from this object might be confusing as is could report an unmanaged field as being shared. We allow users set this flag to false and to leave the output in a bad state since they might want to call this many times in the middle of an evaluation.
template<typename Traits >
template<typename EvalT , typename DataT , int Rank, typename Layout >
void PHX::FieldManager< Traits >::setUnmanagedField ( PHX::Field< DataT, Rank, Layout > &  f,
const bool  cleanup_output = true 
)
inline

Allows the user to manage the memory allocation of a particular field and dynamically set/swap the memory at any time.

This overrides the field allocated to this array in the FieldManager. The fieldManager then sets this new memory pointer in all evaluator fields that use it.

NOTE: this is a very dangerous power user capability as the user must allocate the field correctly (remember Sacado AD types must have the extra dimensions sized correctly).

Parameters
cleanup_output(bool) This flag only matters if this function is called after postRegistrationSetup() is called. If set to true and called after postRegistrationSetup(), this will take more execution time to search field lists to cleanup data structures for output information. This is important because a user could toggle a field that was tagged as shared during postRegistrationSetup() into an unmanaged state. The code will always perform correctly, but output from this object might be confusing as is could report an unmanaged field as being shared. We allow users set this flag to false and to leave the output in a bad state since they might want to call this many times in the middle of an evaluation.

References PHX::Field< DataT, Rank, Layout >::get_static_view().

template<typename Traits >
template<typename EvalT , typename DataT , typename Layout>
void PHX::FieldManager< Traits >::setUnmanagedField ( const FieldTag ft,
Kokkos::View< DataT, Layout, PHX::Device > &  f,
const bool  cleanup_ouput = true 
)
inline

Allows the user to manage the memory allocation of a particular field and dynamically set/swap the memory at any time.

This overrides the field allocated to this array in the FieldManager. The fieldManager then sets this new memory pointer in all evaluator fields that use it.

NOTE: this is a very dangerous power user capability as the user must allocate the field correctly (remember Sacado AD types must have the extra dimensions sized correctly).

Parameters
cleanup_output(bool) This flag only matters if this function is called after postRegistrationSetup() is called. If set to true and called after postRegistrationSetup(), this will take more execution time to search field lists to cleanup data structures for output information. This is important because a user could toggle a field that was tagged as shared during postRegistrationSetup() into an unmanaged state. The code will always perform correctly, but output from this object might be confusing as is could report an unmanaged field as being shared. We allow users set this flag to false and to leave the output in a bad state since they might want to call this many times in the middle of an evaluation.

The documentation for this class was generated from the following files: