MUQ  0.4.3
muq::Modeling::FenicsPiece Class Reference

#include <FenicsPiece.h>

Inheritance diagram for muq::Modeling::FenicsPiece:

Detailed Description

Definition at line 45 of file FenicsPiece.h.

Public Member Functions

 FenicsPiece (pybind11::object const &problemIn, pybind11::object const &outputFieldIn, std::vector< pybind11::object > const &inputs)
 
void EvaluateFunc (std::vector< pybind11::object > const &inputs)
 
virtual void EvaluateImpl (ref_vector< boost::any > const &inputs) override
 User-implemented function that determines the behavior of this muq::Modeling::WorkPiece. More...
 
boost::any EvaluateVec (Eigen::Ref< const Eigen::VectorXd > const &x, std::vector< double > vals)
 
- Public Member Functions inherited from muq::Modeling::WorkPiece
 WorkPiece ()
 Create a muq::Modeling::WorkPiece with no fixed number of inputs and outputs and variable input/output types. More...
 
 WorkPiece (int const num, WorkPiece::Fix const fix=WorkPiece::Fix::Inputs)
 Create a muq::Modeling::WorkPiece with either a fixed number of inputs or outputs and variable input/output types. More...
 
 WorkPiece (int const numIns, int const numOuts)
 Create a muq::Modeling::WorkPiece with a fixed number of inputs and outputs but variable input/output types. More...
 
 WorkPiece (std::vector< std::string > const &types, WorkPiece::Fix const fix=WorkPiece::Fix::Inputs)
 Create a muq::Modeling::WorkPiece with either a fixed number of inputs with specified types or a fixed number of outputs with specified types. More...
 
 WorkPiece (std::map< unsigned int, std::string > const &types, WorkPiece::Fix const fix=WorkPiece::Fix::Inputs)
 Create a muq::Modeling::WorkPiece where either some of the inputs have specified types or some of the outputs have specified types. More...
 
 WorkPiece (std::map< unsigned int, std::string > const &types, int const num, WorkPiece::Fix const fixTypes=WorkPiece::Fix::Inputs, WorkPiece::Fix const fixNum=WorkPiece::Fix::Inputs)
 Create a muq::Modeling::WorkPiece where either some of the inputs have specified types or some of the outputs have specified types and either the number of inputs or the number of outputs is fixed. More...
 
 WorkPiece (std::vector< std::string > const &types, int const num)
 Create a muq::Modeling::WorkPiece with a fixed number of inputs with specified types and a fixed number of outputs (of uknown type) More...
 
 WorkPiece (int const num, std::vector< std::string > const &types)
 Create a muq::Modeling::WorkPiece with a fixed number of outputs with specified types and a fixed number of inputs (of uknown type) More...
 
 WorkPiece (std::map< unsigned int, std::string > const &inTypes, int const numIns, int const numOuts)
 Create a muq::Modeling::WorkPiece where some of the inputs are known and we know the input and output numbers. More...
 
 WorkPiece (int const numIns, std::map< unsigned int, std::string > const &outTypes, int const numOuts)
 Create a muq::Modeling::WorkPiece where some of the outputs are known and we know the input and output numbers. More...
 
 WorkPiece (std::vector< std::string > const &inTypes, std::vector< std::string > const &outTypes)
 Create a muq::Modeling::WorkPiece with a fixed number of inputs and outputs with specified types. More...
 
 WorkPiece (std::map< unsigned int, std::string > const &inTypes, std::vector< std::string > const &outTypes)
 Create a muq::Modeling::WorkPiece where some of the inputs are known and all of the outputs have specified types. More...
 
 WorkPiece (std::map< unsigned int, std::string > const &inTypes, int const num, std::vector< std::string > const &outTypes)
 Create a muq::Modeling::WorkPiece where some of the inputs are known with a known number of inputs and all of the outputs have specified types. More...
 
 WorkPiece (std::vector< std::string > const &inTypes, std::map< unsigned int, std::string > const &outTypes)
 Create a muq::Modeling::WorkPiece where some of the outputs and all of the inputs have specified types. More...
 
 WorkPiece (std::vector< std::string > const &inTypes, std::map< unsigned int, std::string > const &outTypes, int const num)
 Create a muq::Modeling::WorkPiece where some of the outputs with a known number of outputs and all of the inputs have specified types. More...
 
 WorkPiece (std::map< unsigned int, std::string > const &inTypes, std::map< unsigned int, std::string > const &outTypes)
 Create a muq::Mdoeling::WorkPiece where some of the inputs and some of the outputs have specified types. More...
 
 WorkPiece (std::map< unsigned int, std::string > const &inTypes, int const numIn, std::map< unsigned int, std::string > const &outTypes)
 Create a muq::Mdoeling::WorkPiece where some of the inputs and some of the outputs have specified types with a fixed number of inputs. More...
 
 WorkPiece (std::map< unsigned int, std::string > const &inTypes, std::map< unsigned int, std::string > const &outTypes, int const numOut)
 Create a muq::Mdoeling::WorkPiece where some of the inputs and some of the outputs have specified types with a fixed number of outputs. More...
 
 WorkPiece (std::map< unsigned int, std::string > const &inTypes, int const numIn, std::map< unsigned int, std::string > const &outTypes, int const numOut)
 Create a muq::Mdoeling::WorkPiece where some of the inputs and some of the outputs have specified types with a fixed number of inputs and outputs. More...
 
virtual ~WorkPiece ()
 Default destructor. More...
 
std::vector< boost::any > const & Evaluate (std::vector< boost::any > const &ins)
 Evaluate this muq::Modeling::WorkPiece. More...
 
std::vector< boost::any > const & Evaluate (ref_vector< boost::any > const &ins)
 Evaluate this muq::Modeling::WorkPiece using references to the inputs. More...
 
std::vector< boost::any > const & Evaluate ()
 Evaluate this muq::Modeling::WorkPiece in the case that there are no inputs. More...
 
template<typename... Args>
std::vector< boost::any > const & Evaluate (Args... args)
 Evalaute this muq::Modeling::WorkPiece using multiple arguments. More...
 
std::string const & Name ()
 Get the (unique) name of this work piece. More...
 
void SetName (std::string const &newName)
 Set the name of this work piece. More...
 
std::string InputType (unsigned int inputNum, bool const demangle=true) const
 Get the input type (if we know it) for a specific input. More...
 
int InputSize (unsigned int inputNum) const
 Get the length of a vector valued input with fixed size. More...
 
void SetInputSize (unsigned int inputNum, int newSize)
 
std::string OutputType (unsigned int outputNum, bool const demangle=true) const
 Get the output type (if we know it) for a specific output. More...
 
std::map< unsigned int, std::string > OutputTypes () const
 Get the output types. More...
 
std::map< unsigned int, std::string > InputTypes () const
 Get the input types. More...
 
unsigned int ID () const
 Get the unique ID number. More...
 
virtual double GetRunTime (const std::string &method="Evaluate") const
 Get the average run time for one of the implemented methods. More...
 
virtual unsigned long int GetNumCalls (const std::string &method="Evaluate") const
 get the number of times one of the implemented methods has been called. More...
 
virtual void ResetCallTime ()
 Resets the number of call and times. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from muq::Modeling::WorkPiece
static ref_vector< const boost::any > ToRefVector (std::vector< boost::any > const &anyVec)
 Create vector of references from a vector of boost::any's. More...
 
static ref_vector< const Eigen::VectorXd > ToRefVector (std::vector< Eigen::VectorXd > const &anyVec)
 
- Public Attributes inherited from muq::Modeling::WorkPiece
int numInputs
 The number of inputs. More...
 
int numOutputs
 The number of outputs. More...
 

Constructor & Destructor Documentation

◆ FenicsPiece()

muq::Modeling::FenicsPiece::FenicsPiece ( pybind11::object const &  problemIn,
pybind11::object const &  outputFieldIn,
std::vector< pybind11::object > const &  inputs 
)
inline

Definition at line 49 of file FenicsPiece.h.

References CheckProblemType(), ExtractInputs(), outputField, and problem.

Member Function Documentation

◆ CheckProblemType()

static void muq::Modeling::FenicsPiece::CheckProblemType ( pybind11::object const &  obj,
std::string const &  requiredType 
)
inlinestaticprivate

Definition at line 170 of file FenicsPiece.h.

Referenced by EvaluateFunc(), ExtractInputs(), and FenicsPiece().

◆ EvaluateFunc()

void muq::Modeling::FenicsPiece::EvaluateFunc ( std::vector< pybind11::object > const &  inputs)
inline

◆ EvaluateImpl()

virtual void muq::Modeling::FenicsPiece::EvaluateImpl ( ref_vector< boost::any > const &  inputs)
inlineoverridevirtual

User-implemented function that determines the behavior of this muq::Modeling::WorkPiece.

This function determines how the WorkPiece::inputs determine WorkPiece::outputs. Must be implemented by a child.

WorkPiece::Evaluate() calls this function after checking the inputs and storing them in WorkPiece::inputs. This function populates WorkPiece::outputs, the outputs of this muq::Modeling::WorkPiece. WorkPiece::Evaluate() checks the outputs after calling this function.

Implements muq::Modeling::WorkPiece.

Definition at line 91 of file FenicsPiece.h.

References inputExprs, inputFuncs, nlohmann::detail::dtoa_impl::k, outputField, muq::Modeling::WorkPiece::outputs, and problem.

◆ EvaluateVec()

boost::any muq::Modeling::FenicsPiece::EvaluateVec ( Eigen::Ref< const Eigen::VectorXd > const &  x,
std::vector< double >  vals 
)
inline

Definition at line 146 of file FenicsPiece.h.

References outputField, and problem.

◆ ExtractInputs()

void muq::Modeling::FenicsPiece::ExtractInputs ( std::vector< pybind11::object > const &  inputs)
inlineprivate

Definition at line 180 of file FenicsPiece.h.

References CheckProblemType(), inputExprs, inputFuncs, and muq::Modeling::WorkPiece::name.

Referenced by FenicsPiece().

Member Data Documentation

◆ inputExprs

std::map<unsigned, std::pair<pybind11::object, std::vector<std::string> > > muq::Modeling::FenicsPiece::inputExprs
private

Definition at line 214 of file FenicsPiece.h.

Referenced by EvaluateFunc(), EvaluateImpl(), and ExtractInputs().

◆ inputFuncs

std::map<unsigned, std::shared_ptr<dolfin::Function> > muq::Modeling::FenicsPiece::inputFuncs
private

Definition at line 215 of file FenicsPiece.h.

Referenced by EvaluateFunc(), EvaluateImpl(), and ExtractInputs().

◆ outputField

std::shared_ptr<dolfin::Function> muq::Modeling::FenicsPiece::outputField
private

Definition at line 217 of file FenicsPiece.h.

Referenced by EvaluateImpl(), EvaluateVec(), and FenicsPiece().

◆ problem

std::shared_ptr<dolfin::LinearVariationalProblem> muq::Modeling::FenicsPiece::problem
private

Definition at line 218 of file FenicsPiece.h.

Referenced by EvaluateFunc(), EvaluateImpl(), EvaluateVec(), and FenicsPiece().


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