11#ifndef __OPERATORS_TESTER_HPP__
12#define __OPERATORS_TESTER_HPP__
54 std::vector<RandomFieldData> random_fields,
55 boost::shared_ptr<Range> ents =
nullptr,
73 boost::shared_ptr<FEMethod> pipeline,
94 boost::shared_ptr<FEMethod> pipeline,
142 boost::shared_ptr<FEMethod> pipeline_rhs,
152 PetscReal &assembled_derivative);
159 Vec x, Vec direction, Vec function_layout, Mat
jacobian,
double eps,
SmartPetscObj< Vec > gradient
SmartPetscObj< Mat > jacobian
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
boost::shared_ptr< CacheTuple > CacheTupleSharedPtr
boost::weak_ptr< CacheTuple > CacheTupleWeakPtr
Calculate directional derivative of the right hand side and compare it with tangent matrix derivative...
SmartPetscObj< Mat > assembleMat(SmartPetscObj< DM > dm, std::string fe_name, boost::shared_ptr< FEMethod > pipeline, SmartPetscObj< Vec > x, SmartPetscObj< Vec > delta_x, SmartPetscObj< Vec > delta2_x, double time, double delta_t, CacheTupleWeakPtr cache_ptr)
Assemble the left hand side vector.
SmartPetscObj< Vec > checkCentralFiniteDifference(SmartPetscObj< DM > dm, std::string fe_name, boost::shared_ptr< FEMethod > pipeline_rhs, boost::shared_ptr< FEMethod > pipeline_lhs, SmartPetscObj< Vec > x, SmartPetscObj< Vec > delta_x, SmartPetscObj< Vec > delta2_x, SmartPetscObj< Vec > diff_x, double time, double delta_t, double eps, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Check consistency between directional derivative with matrix.
std::pair< std::string, std::array< double, 2 > > RandomFieldData
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
MoFEMErrorCode checkScalarCentralFiniteDifference(Vec x, Vec direction, Vec gradient, double eps, const ScalarFunction &evaluate, PetscReal &finite_difference, PetscReal &assembled_derivative)
virtual ~OperatorsTester()=default
std::function< MoFEMErrorCode(Vec, PetscReal &)> ScalarFunction
SmartPetscObj< Vec > assembleVec(SmartPetscObj< DM > dm, std::string fe_name, boost::shared_ptr< FEMethod > pipeline, SmartPetscObj< Vec > x, SmartPetscObj< Vec > delta_x, SmartPetscObj< Vec > delta2_x, double time, double delta_t, CacheTupleWeakPtr cache_ptr)
Assemble the right hand side vector.
SmartPetscObj< Vec > setRandomFields(SmartPetscObj< DM > dm, std::vector< RandomFieldData > random_fields, boost::shared_ptr< Range > ents=nullptr, RowColData r=RowColData::COL)
Generate random fields.
std::pair< SmartPetscObj< Vec >, SmartPetscObj< Vec > > setPipelineX(boost::shared_ptr< FEMethod > pipeline, SmartPetscObj< Vec > x, SmartPetscObj< Vec > delta_x, SmartPetscObj< Vec > delta2_x, double delta_t)
Set vectors, x, x_t, and x_tt to finite element instance.
std::function< MoFEMErrorCode(Vec, Vec)> VectorFunction
MoFEMErrorCode checkVectorCentralFiniteDifference(Vec x, Vec direction, Vec function_layout, Mat jacobian, double eps, const VectorFunction &evaluate, Vec error)
SmartPetscObj< Vec > directionalCentralFiniteDifference(SmartPetscObj< DM > dm, std::string fe_name, boost::shared_ptr< FEMethod > pipeline, SmartPetscObj< Vec > x, SmartPetscObj< Vec > delta_x, SmartPetscObj< Vec > delta2_x, SmartPetscObj< Vec > diff_x, double time, double delta_t, double eps, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Calculate directional directive using finite difference.
intrusive_ptr for managing petsc objects
base class for all interface classes