47 std::vector<AsyncExchangeContex> m_uiMPIContexts;
166 subDA(
DA* da, std::function<
double (
double,
double,
double ) > fx_retain,
double* gSize);
214 return MPI_COMM_NULL;
298 int createVector(T*& local,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1)
const;
308 int createVector(std::vector<T>& local,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1)
const;
314 template <
typename T>
317 template <
typename T>
323 template<ot::DA_FLAGS::LoopType type>
331 template<ot::DA_FLAGS::LoopType type>
335 template<ot::DA_FLAGS::LoopType type>
391 template <
typename T>
401 template <
typename T>
416 int getNodeIndices(DendroIntL* nodeIdx,
unsigned int ele,
bool isGhosted)
const;
434 template <
typename T>
435 void setVectorByFunction(T* local,std::function<
void(T,T,T,T*)>func,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1)
const;
448 template <
typename T>
449 void setVectorByScalar(T* local,
const T* value,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1)
const;
459 template <
typename T>
460 void vecTopvtu(T* local,
const char * fPrefix,
char** nodalVarNames=NULL,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1);
466 inline unsigned int getLevel(
unsigned int ele)
const {
return m_da->
getLevel(m_uip_sub2DA_ElemMap[ele]);}
483 T*
getVecPointerToDof(T* in ,
unsigned int dofInex,
bool isElemental=
false,
bool isGhosted=
false)
const;
495 void copyVectors(T* dest,
const T* source,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1)
const;
505 void copyVector(T* dest,
const T* source,
bool isElemental=
false,
bool isGhosted=
false)
const;
528 void intergridTransfer(
const T* varIn, T* & varOut,
const ot::DA* newDA,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1);
544 int getFaceNeighborValues(
unsigned int eleID,
const T* in, T* out, T* coords,
unsigned int * neighID,
unsigned int face, NeighbourLevel & level)
const;
548 #ifdef BUILD_WITH_PETSC 558 PetscErrorCode petscCreateVector(Vec &local,
bool isElemental,
bool isGhosted,
unsigned int dof)
const;
567 PetscErrorCode createMatrix(Mat &M, MatType mtype,
unsigned int dof=1)
const;
578 PetscErrorCode petscNodalVecToGhostedNodal(
const Vec& in,Vec& out,
bool isAllocated=
false,
unsigned int dof=1)
const;
589 PetscErrorCode petscGhostedNodalToNodalVec(
const Vec& gVec,Vec& local,
bool isAllocated=
false,
unsigned int dof=1)
const;
598 void petscReadFromGhostBegin(PetscScalar * vecArry,
unsigned int dof=1) ;
606 void petscReadFromGhostEnd(PetscScalar * vecArry,
unsigned int dof=1) ;
619 void petscSetVectorByFunction(Vec& local,std::function<
void(T,T,T,T*)>func,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1)
const;
632 template <
typename T>
633 void petscSetVectorByScalar(Vec& local,
const T* value,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1)
const;
643 void petscVecTopvtu(
const Vec& local,
const char * fPrefix,
char** nodalVarNames=NULL,
bool isElemental=
false,
bool isGhosted=
false,
unsigned int dof=1) ;
658 PetscErrorCode petscSetValuesInMatrix(Mat mat, std::vector<ot::MatRecord>& records,
unsigned int dof, InsertMode mode)
const;
669 PetscErrorCode petscChangeVecToMatBased(Vec& v1,
bool isElemental,
bool isGhosted,
unsigned int dof=1)
const;
677 PetscErrorCode petscChangeVecToMatFree(Vec& v1,
bool isElemental,
bool isGhosted,
unsigned int dof=1)
const;
688 void petscIntergridTransfer(
const Vec &varIn, Vec &varOut,
const ot::DA *newDA,
bool isElemental =
false,
bool isGhosted =
false,
unsigned int dof = 1);
694 PetscErrorCode petscDestroyVec(Vec & vec);
706 #include "sub_oda.tcc" std::vector< unsigned int > m_uip_DA2sub_ElemMap
: DA to subDA map (elemental)
Definition: sub_oda.h:57
void ghostedNodalToNodalVec(const T *gVec, T *&local, bool isAllocated=false, unsigned int dof=1) const
convert ghosted nodal vector to local vector (without ghosting)
unsigned int getNumNodesPerElement() const
get number of nodes per element
Definition: oda.h:257
void writeToGhostsBegin(T *vec, unsigned int dof=1)
Initiate accumilation across ghost elements.
int m_uiRankGlobal
: rank global
Definition: sub_oda.h:150
void setVectorByScalar(T *local, const T *value, bool isElemental=false, bool isGhosted=false, unsigned int dof=1) const
initialize a variable vector to a function depends on spatial coords.
Simple class to manage async data transfer in the ODA class.
Definition: asyncExchangeContex.h:16
std::vector< unsigned int > m_uiRecvProcList
Definition: sub_oda.h:135
unsigned int getPreAndPostGhostNodeSize() const
: get the number of pre and post ghost elements
Definition: sub_oda.h:280
void destroyVector(T *&local) const
deallocates the memory allocated for a vector
std::vector< unsigned int > m_uiSendOffsets
: send offsets
Definition: sub_oda.h:129
unsigned int m_uiNodeLocalEnd
Definition: sub_oda.h:99
unsigned int getTotalNodalSz() const
returns the total nodal size (this includes the ghosted region as well.)
Definition: sub_oda.h:182
int getNodeIndices(DendroIntL *nodeIdx, unsigned int ele, bool isGhosted) const
Returns the local indices to the nodes of the current element.
unsigned int m_uiLocalNodeSize
: Local node size
Definition: sub_oda.h:39
MPI_Comm getCommActive() const
: returns the active MPI sub com of the global communicator
Definition: oda.h:275
unsigned int m_uiTotalElementSz
total element size
Definition: sub_oda.h:74
unsigned int getElementSize() const
: get the number of local elements.
Definition: sub_oda.h:271
unsigned int getRankActive() const
: rank w.r.t active comm.
Definition: sub_oda.h:233
void writeToGhostsEnd(T *vec, unsigned int dof=1)
Sync accumilation across ghost elements.
unsigned int m_uiNodeLocalBegin
Definition: sub_oda.h:97
std::vector< unsigned int > m_uiRecvScatterMap
: recv scatter map
Definition: sub_oda.h:122
unsigned int curr()
get the current elmenent in the iteration
unsigned int getLocalNodalSz() const
returns the local nodal size
Definition: sub_oda.h:173
unsigned int getNpesAll() const
: global mpi com. size
Definition: sub_oda.h:218
unsigned int getLevel(unsigned int ele) const
return the level of current octant
Definition: oda.h:578
std::vector< AsyncExchangeContex > m_mpiContexts
: async comm contex
Definition: sub_oda.h:53
MPI_Comm getCommActive() const
: returns the active MPI sub com of the global communicator
Definition: sub_oda.h:209
std::vector< unsigned int > m_uip_DA2sub_NodeMap
: DA to subDA map (nodal)
Definition: sub_oda.h:61
unsigned int m_uiLocalNodalSz
number of local nodes
Definition: sub_oda.h:71
MPI_Comm m_uiCommActive
: MPI_Comm for the active
Definition: sub_oda.h:144
unsigned int m_uiTotalNodalSz
total nodal size (zipped nodal size)
Definition: sub_oda.h:69
A class to manage octants.
Definition: TreeNode.h:35
unsigned int m_uiLocalElementSz
local elemental size
Definition: sub_oda.h:77
Refine
contains the refine flags. DA_NO_CHANGE : no change needed for the octant DA_REFINE : refine the octa...
Definition: oda.h:86
void readFromGhostEnd(T *vec, unsigned int dof=1)
Sync the ghost element exchange.
unsigned int getLevel(unsigned int ele) const
return the level of current octant
Definition: sub_oda.h:466
ot::TreeNode getOctant(unsigned int ele) const
return the TreeNode of the current octnat.
Definition: sub_oda.h:472
unsigned int m_uiNodePreGhostEnd
Definition: sub_oda.h:95
unsigned int getRankActive() const
: rank w.r.t active comm.
Definition: oda.h:299
unsigned int m_uiCommTag
: async comm tag
Definition: sub_oda.h:45
unsigned int m_uiNumPreGhostNodes
Definition: sub_oda.h:113
std::vector< unsigned int > m_uiRecvOffsets
: recv offsets
Definition: sub_oda.h:131
unsigned int end()
Returns if the current element has reached end or not.
unsigned int getTotalElemSz() const
returns the local elemental size (includes the ghost elements as well)
Definition: sub_oda.h:188
unsigned int m_uiElementPreGhostEnd
Definition: sub_oda.h:82
int getGlobalNodeIndices(DendroIntL *nodeIdx, unsigned int ele) const
Returns the global node indices of a given element,.
void getElementNodalValues(const T *in, T *eleVecOut, unsigned int eleID, unsigned int dof=1) const
computes the element nodal values using interpolation if needed.
int getFaceNeighborValues(unsigned int eleID, const T *in, T *out, T *coords, unsigned int *neighID, unsigned int face, NeighbourLevel &level) const
computes the face neighbor points for additional computations for a specified direction.
int createVector(T *&local, bool isElemental=false, bool isGhosted=false, unsigned int dof=1) const
Creates a ODA vector.
unsigned int getLocalElemSz() const
returns the local elemental size
Definition: sub_oda.h:185
bool m_uiIsActive
: active sub da
Definition: sub_oda.h:138
unsigned int m_uiElementLocalEnd
Definition: sub_oda.h:86
std::vector< unsigned int > m_uip_sub2DA_ElemMap
: subDA to DA map (elemental)
Definition: sub_oda.h:55
unsigned int m_uiPreGhostElementSize
: pre ghost element size
Definition: sub_oda.h:35
unsigned int m_uiPostGhostNodeSize
: post ghost node size
Definition: sub_oda.h:43
unsigned int getNpesActive() const
: number of processors active
Definition: sub_oda.h:221
unsigned int getPostGhostElementSize() const
: get the number of post-ghost element size
Definition: sub_oda.h:277
std::vector< unsigned char > m_ucpSkipList
:elemental skip list
Definition: sub_oda.h:29
bool isBoundaryOctant(unsigned int eleID) const
: returns true if specified eleID is a boundary element false if the eleID is local and not a boundar...
unsigned int m_uiNodePreGhostBegin
Definition: sub_oda.h:93
unsigned int m_uiNodePostGhostBegin
Definition: sub_oda.h:101
unsigned int m_uiNumPostGhostNodes
Definition: sub_oda.h:117
ot::DA * remesh(const DA_FLAGS::Refine *flags, unsigned int sz, unsigned int grainSz=100, double ld_bal=0.3, unsigned int sfK=2) const
: Performs remesh based on the DA_FLAGS::Refine, which specifies no change, refine or coarsen...
double m_dMinBB[3]
min bound box for fe_retain
Definition: sub_oda.h:64
unsigned int getElementOrder() const
get element order
Definition: sub_oda.h:197
void copyVectors(T *dest, const T *source, bool isElemental=false, bool isGhosted=false, unsigned int dof=1) const
copy vecotor to sorce to destination, assumes the same number of dof.
double m_dMaxBB[3]
max bound box for fe_retain
Definition: sub_oda.h:66
: Simple structure to keep the loop counters
Definition: oda.h:117
unsigned int getElementOrder() const
get element order
Definition: oda.h:260
ot::DA * m_da
: parent da
Definition: sub_oda.h:27
void init()
initialize the loop counters.
subDA(DA *da, std::function< double(double, double, double) > fx_retain, double *gSize)
: defult sub da constructor.
Definition: sub_oda.cpp:11
unsigned int m_uiNumPreGhostElements
Definition: sub_oda.h:106
unsigned int getMaxDepth() const
: get the max depth of the octree
Definition: sub_oda.h:286
unsigned int m_uiLocalElementSize
: local element size
Definition: sub_oda.h:33
void eleVecToVecAccumilation(T *out, const T *eleVecIn, unsigned int eleID, unsigned int dof=1) const
computes the elemental vec to global vec accumilation
unsigned int getNumNodesPerElement() const
get number of nodes per element
Definition: sub_oda.h:194
subDA based on the DA, where to perform computations sub domain of the main domain.
Definition: sub_oda.h:22
std::vector< unsigned int > m_uiSendCounts
: send counts
Definition: sub_oda.h:125
unsigned int m_uiNumLocalNodes
Definition: sub_oda.h:115
unsigned int m_uiElementLocalBegin
Definition: sub_oda.h:84
void copyVector(T *dest, const T *source, bool isElemental=false, bool isGhosted=false) const
more premitive copy, from source pointer to the dest pointer
void getOctreeBoundaryNodeIndices(std::vector< unsigned int > &bdyIndex, std::vector< double > &coords, bool isGhosted=false)
Computes the octree writable boundary nodes.
std::vector< unsigned char > m_ucpSkipNodeList
:nodal skip list
Definition: sub_oda.h:31
void getElementalCoords(unsigned int eleID, double *coords) const
computes the elementCoordinates (based on the nodal placement)
The class that manages the octree mesh that support FEM computations. Note that this file is a refact...
unsigned int m_uiElementPostGhostBegin
Definition: sub_oda.h:88
std::vector< unsigned int > m_uiSendProcList
Definition: sub_oda.h:133
const RefElement * getReferenceElement() const
get a constant pointer for the reference element
Definition: oda.h:333
unsigned int getPreNodalSz() const
returns the pre ghost nodal size
Definition: sub_oda.h:176
unsigned int m_uiNumPostGhostElements
Definition: sub_oda.h:110
unsigned int getDimension() const
: get the dimensionality of the octree
Definition: sub_oda.h:288
const ot::Mesh * getMesh() const
: returns node local to node global map
Definition: sub_oda.h:206
unsigned int m_uiPostGhostElementSize
: post ghost element size
Definition: sub_oda.h:37
int m_uiRankActive
: rank active
Definition: sub_oda.h:147
std::vector< unsigned int > m_uip_sub2DA_NodeMap
: subDA to DA map (nodal)
Definition: sub_oda.h:59
unsigned int m_uiElementPreGhostBegin
Definition: sub_oda.h:80
LoopCounter m_uiLoopInfo
: Loop counter info
Definition: sub_oda.h:50
std::vector< unsigned int > m_uiSendScatterMap
: Send scatter map
Definition: sub_oda.h:120
unsigned int m_uiPreGhostNodeSize
: pre ghost node size
Definition: sub_oda.h:41
unsigned int getRankAll() const
: rank with respect to the global comm.
Definition: oda.h:296
bool isActive() const
see if the current DA is active
Definition: oda.h:254
unsigned int getPostNodalSz() const
returns the post nodal size
Definition: sub_oda.h:179
const RefElement * getReferenceElement() const
get a constant pointer for the reference element
Definition: sub_oda.h:267
unsigned int getGhostedElementSize() const
: get the number of pre and post ghost elements
Definition: sub_oda.h:283
int m_uiNpesActive
: npes active
Definition: sub_oda.h:153
void vecTopvtu(T *local, const char *fPrefix, char **nodalVarNames=NULL, bool isElemental=false, bool isGhosted=false, unsigned int dof=1)
write the vec to pvtu file
unsigned int m_uiNumLocalElements
Definition: sub_oda.h:108
unsigned int getNpesActive() const
: number of processors active
Definition: oda.h:287
void intergridTransfer(const T *varIn, T *&varOut, const ot::DA *newDA, bool isElemental=false, bool isGhosted=false, unsigned int dof=1)
performs grid transfer operations after the remesh.
void next()
: increment it to the next element.
MPI_Comm m_uiCommGlobal
: MPI comm global
Definition: sub_oda.h:141
unsigned int getNpesAll() const
: global mpi com. size
Definition: oda.h:284
void setVectorByFunction(T *local, std::function< void(T, T, T, T *)>func, bool isElemental=false, bool isGhosted=false, unsigned int dof=1) const
initialize a variable vector to a function depends on spatial coords.
ot::TreeNode getOctant(unsigned int ele) const
return the TreeNode of the current octnat.
Definition: oda.h:584
unsigned int getPreGhostElementSize() const
: get the number of pre-ghost element size
Definition: sub_oda.h:274
void nodalVecToGhostedNodal(const T *in, T *&out, bool isAllocated=false, unsigned int dof=1) const
convert nodal local vector with ghosted buffer regions.
MPI_Comm getGlobalComm() const
: returns the global MPI communicator
Definition: oda.h:263
unsigned int getRankAll() const
: rank with respect to the global comm.
Definition: sub_oda.h:230
unsigned int m_uiNodePostGhostEnd
Definition: sub_oda.h:103
bool isActive() const
see if the current DA is active
Definition: sub_oda.h:191
const ot::Mesh * getMesh() const
returns the mesh
Definition: oda.h:269
int m_uiNpesGlobal
: npes global
Definition: sub_oda.h:156
MPI_Comm getGlobalComm() const
: returns the global MPI communicator
Definition: sub_oda.h:200
std::vector< unsigned int > m_uiRecvCounts
: recv counts
Definition: sub_oda.h:127
void readFromGhostBegin(T *vec, unsigned int dof=1)
Initiate the ghost nodal value exchange.
unsigned int m_uiElementPostGhostEnd
Definition: sub_oda.h:90
T * getVecPointerToDof(T *in, unsigned int dofInex, bool isElemental=false, bool isGhosted=false) const
returns a pointer to a dof index,