IBAMR  IBAMR version 0.19.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
IBTK::LData Class Reference

Class LData provides storage for a single scalar- or vector-valued Lagrangian quantity.

#include <ibtk/LData.h>

Inheritance diagram for IBTK::LData:
Inheritance graph
[legend]

Public Member Functions

 LData (std::string name, unsigned int num_local_nodes, unsigned int depth, std::vector< int > nonlocal_petsc_indices=std::vector< int >(0))
 Constructor. More...
 
 LData (std::string name, Vec vec, std::vector< int > nonlocal_petsc_indices=std::vector< int >(0), const bool manage_petsc_vec=true)
 Constructor. More...
 
 LData (SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > db)
 Constructor. More...
 
virtual ~LData ()
 Virtual destructor. More...
 
virtual void resetData (Vec vec, const std::vector< int > &nonlocal_petsc_indices=std::vector< int >(0), const bool manage_petsc_vec=true)
 Reset data items. More...
 
const std::string & getName () const
 Returns a const reference to the name of this LData object. More...
 
unsigned int getGlobalNodeCount () const
 Returns the total number of Lagrangian nodes. More...
 
unsigned int getLocalNodeCount () const
 Returns the number of local (i.e., on processor) Lagrangian nodes. More...
 
unsigned int getGhostNodeCount () const
 Returns the number of local ghost nodes associated with the LData object. More...
 
unsigned int getDepth () const
 Returns the depth (i.e., the number of components per node) of the Lagrangian data. More...
 
Vec getVec ()
 Returns the PETSc Vec object that stores the data. More...
 
boost::multi_array_ref< double, 1 > * getArray ()
 Returns a pointer to a boost::multi_array_ref object that wraps the array corresponding to the PETSc Vec object. This method is appropriate only for scalar-valued quantities. More...
 
boost::multi_array_ref< double, 1 > * getLocalFormArray ()
 Returns a pointer to a boost::multi_array_ref object that wraps the array corresponding to the PETSc Vec object. This method is appropriate only for scalar-valued quantities. More...
 
boost::multi_array_ref< double, 1 > * getGhostedLocalFormArray ()
 Returns a pointer to a boost::multi_array_ref object that wraps the array corresponding to the ghosted local part of the PETSc Vec object. This method is appropriate only for scalar-valued quantities. More...
 
boost::multi_array_ref< double, 2 > * getVecArray ()
 Returns a pointer to a boost::multi_array_ref object that wraps the array corresponding to the PETSc Vec object. This method is appropriate for either scalar- or vector-valued quantities. More...
 
boost::multi_array_ref< double, 2 > * getLocalFormVecArray ()
 Returns a pointer to a boost::multi_array_ref object that wraps the array corresponding to the PETSc Vec object. This method is appropriate for either scalar- or vector-valued quantities. More...
 
boost::multi_array_ref< double, 2 > * getGhostedLocalFormVecArray ()
 Returns a pointer to a boost::multi_array_ref object that wraps the array corresponding to the ghosted local part of the PETSc Vec object. This method is appropriate for either scalar- or vector-valued quantities. More...
 
void restoreArrays ()
 Restore any arrays extracted via calls to getArray(), getLocalFormArray(), and getGhostedLocalFormArray(). More...
 
void beginGhostUpdate ()
 Begin updating ghost values. More...
 
void endGhostUpdate ()
 End updating ghost values. More...
 
void putToDatabase (SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > db) override
 Write out object state to the given database. More...
 

Private Member Functions

 LData ()=delete
 Default constructor. More...
 
 LData (const LData &from)=delete
 Copy constructor. More...
 
template<std::size_t dim>
void destroy_ref (boost::multi_array_ref< double, dim > &ref)
 
void getArrayCommon ()
 
void getGhostedLocalFormArrayCommon ()
 

Private Attributes

std::string d_name
 
unsigned int d_global_node_count = 0
 
unsigned int d_local_node_count = 0
 
unsigned int d_ghost_node_count = 0
 
unsigned int d_depth = 0
 
std::vector< intd_nonlocal_petsc_indices
 
Vec d_global_vec = nullptr
 
bool d_managing_petsc_vec = true
 
doubled_array = nullptr
 
boost::multi_array_ref< double, 1 > d_boost_array { nullptr, std::vector<int>{ 0 } }
 
boost::multi_array_ref< double, 1 > d_boost_local_array { nullptr, std::vector<int>{ 0 } }
 
boost::multi_array_ref< double, 2 > d_boost_vec_array { nullptr, std::vector<int>{ 0, 0 } }
 
boost::multi_array_ref< double, 2 > d_boost_local_vec_array { nullptr, std::vector<int>{ 0, 0 } }
 
Vec d_ghosted_local_vec = nullptr
 
doubled_ghosted_local_array = nullptr
 
boost::multi_array_ref< double, 1 > d_boost_ghosted_local_array { nullptr, std::vector<int>{ 0 } }
 
boost::multi_array_ref< double, 2 > d_boost_vec_ghosted_local_array { nullptr, std::vector<int>{ 0, 0 } }
 

Constructor & Destructor Documentation

◆ LData() [1/5]

IBTK::LData::LData ( std::string  name,
unsigned int  num_local_nodes,
unsigned int  depth,
std::vector< int nonlocal_petsc_indices = std::vector< int >(0) 
)
Note
This constructor will allocate an appropriately sized PETSc Vec object. Data management for this PETSc Vec object is handled by the LData object.

◆ LData() [2/5]

IBTK::LData::LData ( std::string  name,
Vec  vec,
std::vector< int nonlocal_petsc_indices = std::vector< int >(0),
const bool  manage_petsc_vec = true 
)
Note
This constructor does not allocate a PETSc Vec object. Instead, it can assume responsibilities for data management for the supplied PETSc Vec object. In particular, the caller must not destroy the PETSc Vec object provided to the class constructor, if it is instructed to manage the PETSc Vec.
The blocksize of the supplied PETSc Vec object must be set appropriately. Its value is used to determine the data depth (i.e., the number of data components per node).

◆ LData() [3/5]

IBTK::LData::LData ( SAMRAI::tbox::Pointer< SAMRAI::tbox::Database db)

◆ ~LData()

virtual IBTK::LData::~LData ( )
virtual

◆ LData() [4/5]

IBTK::LData::LData ( )
privatedelete
Note
This constructor is not implemented and should not be used.

◆ LData() [5/5]

IBTK::LData::LData ( const LData from)
privatedelete
Parameters
fromThe value to copy to this object.
Note
This constructor is not implemented and should not be used.

Member Function Documentation

◆ resetData()

virtual void IBTK::LData::resetData ( Vec  vec,
const std::vector< int > &  nonlocal_petsc_indices = std::vector< int >(0),
const bool  manage_petsc_vec = true 
)
virtual
Note
The LData object assumes responsibilities for data management for the supplied PETSc Vec object. In particular, the caller must not destroy the PETSc Vec object provided to resetData().
The blocksize of the supplied PETSc Vec object must be set appropriately. Its value is used to determine the data depth (i.e., the number of data components per node).

◆ getName()

const std::string & IBTK::LData::getName ( ) const
inline

◆ getGlobalNodeCount()

unsigned int IBTK::LData::getGlobalNodeCount ( ) const
inline

◆ getLocalNodeCount()

unsigned int IBTK::LData::getLocalNodeCount ( ) const
inline
Note
This count does not include ghost nodes (if any).

◆ getGhostNodeCount()

unsigned int IBTK::LData::getGhostNodeCount ( ) const
inline

◆ getDepth()

unsigned int IBTK::LData::getDepth ( ) const
inline

◆ getVec()

Vec IBTK::LData::getVec ( )
inline
Note
getVec() calls restoreArrays(), which invalidates any oustanding references to the underlying array data.
See also
restoreArrays()

◆ getArray()

boost::multi_array_ref< double, 1 > * IBTK::LData::getArray ( )
inline
Note
Only local data are accessible via the returned array. Nonlocal data must be accessed via appropriate PETSc function calls.
The returned array is indexed using the global PETSc indexing scheme.
Any outstanding references to the underlying array data are invalidated by restoreArrays().
See also
restoreArrays()

◆ getLocalFormArray()

boost::multi_array_ref< double, 1 > * IBTK::LData::getLocalFormArray ( )
inline
Note
Only local data are accessible via the returned array. Nonlocal data must be accessed via appropriate PETSc function calls.
The returned array is indexed using the local PETSc indexing scheme.
Any outstanding references to the underlying array data are invalidated by restoreArrays().
See also
restoreArrays()

◆ getGhostedLocalFormArray()

boost::multi_array_ref< double, 1 > * IBTK::LData::getGhostedLocalFormArray ( )
inline
Note
Only local (i.e., on processor) and ghost node data are accessible via this array. All other nonlocal data must be accessed via appropriate PETSc function calls.
The returned array object is indexed using the local PETSc indexing scheme.
Any outstanding references to the underlying array data are invalidated by restoreArrays().
See also
restoreArrays()

◆ getVecArray()

boost::multi_array_ref< double, 2 > * IBTK::LData::getVecArray ( )
inline
Note
Only local data are accessible via the returned array. Nonlocal data must be accessed via appropriate PETSc function calls.
The returned array is indexed using the global PETSc indexing scheme.
Any outstanding references to the underlying array data are invalidated by restoreArrays().
See also
restoreArrays()

◆ getLocalFormVecArray()

boost::multi_array_ref< double, 2 > * IBTK::LData::getLocalFormVecArray ( )
inline
Note
Only local data are accessible via the returned array. Nonlocal data must be accessed via appropriate PETSc function calls.
The returned array is indexed using the local PETSc indexing scheme.
Any outstanding references to the underlying array data are invalidated by restoreArrays().
See also
restoreArrays()

◆ getGhostedLocalFormVecArray()

boost::multi_array_ref< double, 2 > * IBTK::LData::getGhostedLocalFormVecArray ( )
inline
Note
Only local (i.e., on processor) and ghost node data are accessible via this array. All other nonlocal data must be accessed via appropriate PETSc function calls.
The returned array object is indexed using the local PETSc indexing scheme.
Any outstanding references to the underlying array data are invalidated by restoreArrays().
See also
restoreArrays()

◆ restoreArrays()

void IBTK::LData::restoreArrays ( )
inline
Note
Any outstanding references to the underlying array data are invalidated by restoreArrays().

◆ beginGhostUpdate()

void IBTK::LData::beginGhostUpdate ( )
inline

◆ endGhostUpdate()

void IBTK::LData::endGhostUpdate ( )
inline

◆ putToDatabase()

void IBTK::LData::putToDatabase ( SAMRAI::tbox::Pointer< SAMRAI::tbox::Database db)
overridevirtual

◆ destroy_ref()

template<std::size_t dim>
void IBTK::LData::destroy_ref ( boost::multi_array_ref< double, dim > &  ref)
private

Convenience method for doing in-place destruction of array references.

◆ getArrayCommon()

void IBTK::LData::getArrayCommon ( )
inlineprivate

◆ getGhostedLocalFormArrayCommon()

void IBTK::LData::getGhostedLocalFormArrayCommon ( )
inlineprivate

Member Data Documentation

◆ d_name

std::string IBTK::LData::d_name
private

◆ d_global_node_count

unsigned int IBTK::LData::d_global_node_count = 0
private

◆ d_local_node_count

unsigned int IBTK::LData::d_local_node_count = 0
private

◆ d_ghost_node_count

unsigned int IBTK::LData::d_ghost_node_count = 0
private

◆ d_depth

unsigned int IBTK::LData::d_depth = 0
private

◆ d_nonlocal_petsc_indices

std::vector<int> IBTK::LData::d_nonlocal_petsc_indices
private

◆ d_global_vec

Vec IBTK::LData::d_global_vec = nullptr
private

◆ d_managing_petsc_vec

bool IBTK::LData::d_managing_petsc_vec = true
private

◆ d_array

double* IBTK::LData::d_array = nullptr
private

◆ d_boost_array

boost::multi_array_ref<double, 1> IBTK::LData::d_boost_array { nullptr, std::vector<int>{ 0 } }
private

◆ d_boost_local_array

boost::multi_array_ref<double, 1> IBTK::LData::d_boost_local_array { nullptr, std::vector<int>{ 0 } }
private

◆ d_boost_vec_array

boost::multi_array_ref<double, 2> IBTK::LData::d_boost_vec_array { nullptr, std::vector<int>{ 0, 0 } }
private

◆ d_boost_local_vec_array

boost::multi_array_ref<double, 2> IBTK::LData::d_boost_local_vec_array { nullptr, std::vector<int>{ 0, 0 } }
private

◆ d_ghosted_local_vec

Vec IBTK::LData::d_ghosted_local_vec = nullptr
private

◆ d_ghosted_local_array

double* IBTK::LData::d_ghosted_local_array = nullptr
private

◆ d_boost_ghosted_local_array

boost::multi_array_ref<double, 1> IBTK::LData::d_boost_ghosted_local_array { nullptr, std::vector<int>{ 0 } }
private

◆ d_boost_vec_ghosted_local_array

boost::multi_array_ref<double, 2> IBTK::LData::d_boost_vec_ghosted_local_array { nullptr, std::vector<int>{ 0, 0 } }
private

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