v0.13.1
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 meshdatabase More...
 
MoFEMErrorCode setLocalGhostVector (const std::string name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to meshdatabase 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
virtual MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const =0
 
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 16 of file VecManager.cpp.

17 : cOre(const_cast<MoFEM::Core &>(core)), dEbug(false) {
18 if (!LogManager::checkIfChannelExist("VECWORLD")) {
19 auto core_log = logging::core::get();
20
21 core_log->add_sink(
23 core_log->add_sink(
25 core_log->add_sink(
27
28 LogManager::setLog("VECWORLD");
29 LogManager::setLog("VECSYNC");
30 LogManager::setLog("VECSELF");
31
32 MOFEM_LOG_TAG("VECWORLD", "VecMng");
33 MOFEM_LOG_TAG("VECSYNC", "VecMng");
34 MOFEM_LOG_TAG("VECSELF", "VecMng");
35 }
36
37 MOFEM_LOG("VECWORLD", Sev::noisy) << "Vector manager created";
38}
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:364
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:301
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:332
Core (interface) class.
Definition: Core.hpp:82
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Definition: LogManager.cpp:279
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:323
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Definition: LogManager.cpp:327
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:374
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Definition: LogManager.cpp:319
const MoFEM::Interface & cOre
Definition: VecManager.hpp:28

◆ ~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 10 of file VecManager.cpp.

11 {
12 *iface = const_cast<VecManager *>(this);
13 return 0;
14}
VecManager(const MoFEM::Core &core)
Definition: VecManager.cpp:16

◆ 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}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEMErrorCode vecCreateGhost(const std::string name, RowColData rc, Vec *V) const
create ghost vector for problem (collective)
Definition: VecManager.cpp:66
const FTensor::Tensor2< T, Dim, Dim > Vec

◆ 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}
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

◆ 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: