v0.13.0
Public Member Functions | Public Attributes | Private Attributes | List of all members
StdRDOperators::Monitor Struct Reference

#include <users_modules/softmech/chemo_mech/src/rd_stdOperators.hpp>

Inheritance diagram for StdRDOperators::Monitor:
[legend]
Collaboration diagram for StdRDOperators::Monitor:
[legend]

Public Member Functions

 Monitor (MPI_Comm &comm, const int &rank, SmartPetscObj< DM > &dm, boost::shared_ptr< PostProcFaceOnRefinedMesh > &post_proc, double &err)
 
MoFEMErrorCode preProcess ()
 
MoFEMErrorCode operator() ()
 
MoFEMErrorCode postProcess ()
 

Public Attributes

double & eRror
 

Private Attributes

SmartPetscObj< DM > dM
 
boost::shared_ptr< PostProcFaceOnRefinedMeshpostProc
 
MPI_Comm cOmm
 
const int rAnk
 

Detailed Description

Definition at line 647 of file rd_stdOperators.hpp.

Constructor & Destructor Documentation

◆ Monitor()

StdRDOperators::Monitor::Monitor ( MPI_Comm &  comm,
const int &  rank,
SmartPetscObj< DM > &  dm,
boost::shared_ptr< PostProcFaceOnRefinedMesh > &  post_proc,
double &  err 
)

Definition at line 649 of file rd_stdOperators.hpp.

651  : cOmm(comm), rAnk(rank), dM(dm), postProc(post_proc), eRror(err){};
SmartPetscObj< DM > dM
boost::shared_ptr< PostProcFaceOnRefinedMesh > postProc

Member Function Documentation

◆ operator()()

MoFEMErrorCode StdRDOperators::Monitor::operator() ( )

Definition at line 653 of file rd_stdOperators.hpp.

653 { return 0; }

◆ postProcess()

MoFEMErrorCode StdRDOperators::Monitor::postProcess ( )

Definition at line 654 of file rd_stdOperators.hpp.

654  {
656  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-save_every_nth_step",
657  &save_every_nth_step, PETSC_NULL);
658  if (ts_step % save_every_nth_step == 0) {
660  CHKERR postProc->writeFile(
661  "out_level_" + boost::lexical_cast<std::string>(ts_step) + ".h5m");
662  }
663  Vec error_per_proc;
664  CHKERR VecCreateMPI(cOmm, 1, PETSC_DECIDE, &error_per_proc);
665  auto get_global_error = [&]() {
667  CHKERR VecSetValue(error_per_proc, rAnk, eRror, INSERT_VALUES);
669  };
670  CHKERR get_global_error();
671  CHKERR VecAssemblyBegin(error_per_proc);
672  CHKERR VecAssemblyEnd(error_per_proc);
673  double error_sum;
674  CHKERR VecSum(error_per_proc, &error_sum);
675  CHKERR PetscPrintf(PETSC_COMM_WORLD, "Error : %3.4e \n", error_sum);
676  eRror = 0;
678  }
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMMoFEM.cpp:544
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)

◆ preProcess()

MoFEMErrorCode StdRDOperators::Monitor::preProcess ( )

Definition at line 652 of file rd_stdOperators.hpp.

652 { return 0; }

Member Data Documentation

◆ cOmm

MPI_Comm StdRDOperators::Monitor::cOmm
private

Definition at line 683 of file rd_stdOperators.hpp.

◆ dM

SmartPetscObj<DM> StdRDOperators::Monitor::dM
private

Definition at line 681 of file rd_stdOperators.hpp.

◆ eRror

double& StdRDOperators::Monitor::eRror

Definition at line 648 of file rd_stdOperators.hpp.

◆ postProc

boost::shared_ptr<PostProcFaceOnRefinedMesh> StdRDOperators::Monitor::postProc
private

Definition at line 682 of file rd_stdOperators.hpp.

◆ rAnk

const int StdRDOperators::Monitor::rAnk
private

Definition at line 684 of file rd_stdOperators.hpp.


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