v0.14.0
Public Member Functions | Public Attributes | List of all members
MoFEM::VecManager Struct Reference

Vector manager is used to create vectors \mofem_vectors. More...

#include <src/interfaces/VecManager.hpp>

Inheritance diagram for MoFEM::VecManager:
[legend]
Collaboration diagram for MoFEM::VecManager:
[legend]

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 
 VecManager (const MoFEM::Core &core)
 
 ~VecManager ()=default
 
MoFEMErrorCode vecCreateSeq (const std::string name, RowColData rc, Vec *V) const
 create local vector for problem More...
 
MoFEMErrorCode vecCreateGhost (const std::string name, RowColData rc, Vec *V) const
 create ghost vector for problem (collective) More...
 
MoFEMErrorCode vecCreateGhost (const std::string name, RowColData rc, SmartPetscObj< Vec > &v_ptr) const
 create ghost vector for problem (collective) More...
 
MoFEMErrorCode vecScatterCreate (Vec xin, const std::string x_problem, const std::string x_field_name, RowColData x_rc, Vec yin, const std::string y_problem, const std::string y_field_name, RowColData y_rc, VecScatter *newctx) const
 create scatter for vectors form one to another problem (collective) More...
 
MoFEMErrorCode vecScatterCreate (Vec xin, const std::string x_problem, const std::string x_field_name, RowColData x_rc, Vec yin, const std::string y_problem, const std::string y_field_name, RowColData y_rc, SmartPetscObj< VecScatter > &smart_newctx) const
 create scatter for vectors form one to another problem (collective) More...
 
MoFEMErrorCode vecScatterCreate (Vec xin, const std::string x_problem, RowColData x_rc, Vec yin, const std::string y_problem, RowColData y_rc, VecScatter *newctx) const
 create scatter for vectors from one to another problem (collective) More...
 
MoFEMErrorCode vecScatterCreate (Vec xin, const std::string x_problem, RowColData x_rc, Vec yin, const std::string y_problem, RowColData y_rc, SmartPetscObj< VecScatter > &smart_newctx) const
 create scatter for vectors form one to another problem (collective) More...
 
MoFEMErrorCode setLocalGhostVector (const Problem *problem_ptr, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to mesh database More...
 
MoFEMErrorCode setLocalGhostVector (const std::string name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to mesh database More...
 
MoFEMErrorCode setGlobalGhostVector (const Problem *problem_ptr, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to mesh database (collective) More...
 
MoFEMErrorCode setGlobalGhostVector (const std::string name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to mesh database (collective) More...
 
MoFEMErrorCode setOtherLocalGhostVector (const Problem *problem_ptr, const std::string field_name, const std::string cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 Copy vector to field which is not part of the problem. More...
 
MoFEMErrorCode setOtherLocalGhostVector (const std::string name, const std::string field_name, const std::string cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 Copy vector to field which is not part of the problem. More...
 
MoFEMErrorCode setOtherGlobalGhostVector (const Problem *problem_ptr, const std::string field_name, const std::string cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 Copy vector to field which is not part of the problem (collective) More...
 
MoFEMErrorCode setOtherGlobalGhostVector (const std::string name, const std::string field_name, const std::string cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 Copy vector to field which is not part of the problem (collective) More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 

Public Attributes

const MoFEM::InterfacecOre
 
bool dEbug
 

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Detailed Description

Vector manager is used to create vectors \mofem_vectors.

Managing Vectors, creation, scatter, etc.

Examples
nonlinear_dynamics.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, and remove_entities_from_problem_not_partitioned.cpp.

Definition at line 23 of file VecManager.hpp.

Constructor & Destructor Documentation

◆ VecManager()

MoFEM::VecManager::VecManager ( const MoFEM::Core core)

Definition at line 14 of file VecManager.cpp.

15  : cOre(const_cast<MoFEM::Core &>(core)), dEbug(false) {
16  if (!LogManager::checkIfChannelExist("VECWORLD")) {
17  auto core_log = logging::core::get();
18 
19  core_log->add_sink(
21  core_log->add_sink(
23  core_log->add_sink(
25 
26  LogManager::setLog("VECWORLD");
27  LogManager::setLog("VECSYNC");
28  LogManager::setLog("VECSELF");
29 
30  MOFEM_LOG_TAG("VECWORLD", "VecMng");
31  MOFEM_LOG_TAG("VECSYNC", "VecMng");
32  MOFEM_LOG_TAG("VECSELF", "VecMng");
33  }
34 
35  MOFEM_LOG("VECWORLD", Sev::noisy) << "Vector manager created";
36 }

◆ ~VecManager()

MoFEM::VecManager::~VecManager ( )
default

Member Function Documentation

◆ query_interface()

MoFEMErrorCode MoFEM::VecManager::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Implements MoFEM::UnknownInterface.

Definition at line 8 of file VecManager.cpp.

9  {
10  *iface = const_cast<VecManager *>(this);
11  return 0;
12 }

◆ vecCreateGhost()

MoFEMErrorCode MoFEM::VecManager::vecCreateGhost ( const std::string  name,
RowColData  rc,
SmartPetscObj< Vec > &  v_ptr 
) const

create ghost vector for problem (collective)

collective - need to be run on all processors in communicator

Parameters
nameproblem name
RowColDataspecify what data is taken from Row, Col or Data
Vecthe vector where data is stored

Definition at line 122 of file VecManager.cpp.

123  {
125  Vec vec;
126  CHKERR vecCreateGhost(name, rc, &vec);
127  v_ptr.reset(vec, false);
129 }

◆ vecScatterCreate() [1/2]

MoFEMErrorCode MoFEM::VecManager::vecScatterCreate ( Vec  xin,
const std::string  x_problem,
const std::string  x_field_name,
RowColData  x_rc,
Vec  yin,
const std::string  y_problem,
const std::string  y_field_name,
RowColData  y_rc,
SmartPetscObj< VecScatter > &  smart_newctx 
) const

create scatter for vectors form one to another problem (collective)

User specify what name of field on one problem is scattered to another.

Parameters
xinvector
x_probleproblem name
x_fieldname
yinvector
y_problemproblem name
y_field_name
Return values
newctxscatter

Definition at line 177 of file VecManager.cpp.

181  {
183  VecScatter newctx;
184  CHKERR vecScatterCreate(xin, x_problem, x_field_name, x_rc, yin, y_problem,
185  y_field_name, y_rc, &newctx);
186  smart_newctx = SmartPetscObj<VecScatter>(newctx);
188 }

◆ vecScatterCreate() [2/2]

MoFEMErrorCode MoFEM::VecManager::vecScatterCreate ( Vec  xin,
const std::string  x_problem,
RowColData  x_rc,
Vec  yin,
const std::string  y_problem,
RowColData  y_rc,
SmartPetscObj< VecScatter > &  smart_newctx 
) const

create scatter for vectors form one to another problem (collective)

User specify what name of field on one problem is scattered to another.

Parameters
xinvector
x_probleproblem name
x_fieldname
yinvector
y_problemproblem name
y_field_name
Return values
newctxscatter

Definition at line 191 of file VecManager.cpp.

194  {
196  VecScatter newctx;
197  CHKERR vecScatterCreate(xin, x_problem, x_rc, yin, y_problem, y_rc, &newctx);
198  smart_newctx = SmartPetscObj<VecScatter>(newctx);
200 }

Member Data Documentation

◆ cOre

const MoFEM::Interface& MoFEM::VecManager::cOre

Definition at line 28 of file VecManager.hpp.

◆ dEbug

bool MoFEM::VecManager::dEbug

Definition at line 29 of file VecManager.hpp.


The documentation for this struct was generated from the following files:
MoFEM::LogManager::checkIfChannelExist
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:404
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
MoFEM::VecManager::vecCreateGhost
MoFEMErrorCode vecCreateGhost(const std::string name, RowColData rc, Vec *V) const
create ghost vector for problem (collective)
Definition: VecManager.cpp:64
MoFEM::LogManager::createSink
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Definition: LogManager.cpp:298
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM::VecManager::cOre
const MoFEM::Interface & cOre
Definition: VecManager.hpp:28
MoFEM::VecManager::vecScatterCreate
MoFEMErrorCode vecScatterCreate(Vec xin, const std::string x_problem, const std::string x_field_name, RowColData x_rc, Vec yin, const std::string y_problem, const std::string y_field_name, RowColData y_rc, VecScatter *newctx) const
create scatter for vectors form one to another problem (collective)
Definition: VecManager.cpp:131
MoFEM::VecManager::dEbug
bool dEbug
Definition: VecManager.hpp:29
MoFEM::LogManager::getStrmSync
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Definition: LogManager.cpp:348
MoFEM::LogManager::getStrmWorld
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:344
MoFEM::LogManager::getStrmSelf
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Definition: LogManager.cpp:340
MOFEM_LOG_TAG
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MoFEM::VecManager::VecManager
VecManager(const MoFEM::Core &core)
Definition: VecManager.cpp:14
MoFEM::LogManager::setLog
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:389
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346