Chi-Tech
|
#include <SpatialDiscretization.h>
Public Types | |
typedef std::function< double(const chi_mesh::Vector3 &)> | SpatialWeightFunction |
Public Member Functions | |
std::pair< std::set< uint32_t >, std::set< uint32_t > > | MakeCellInternalAndBndryNodeIDs (const chi_mesh::Cell &cell) const |
const CellMapping & | GetCellMapping (const chi_mesh::Cell &cell) const |
SpatialDiscretizationType | Type () const |
const chi_mesh::MeshContinuum & | Grid () const |
CoordinateSystemType | GetCoordinateSystemType () const |
virtual void | BuildSparsityPattern (std::vector< int64_t > &nodal_nnz_in_diag, std::vector< int64_t > &nodal_nnz_off_diag, const UnknownManager &unknown_manager) const =0 |
virtual int64_t | MapDOF (const chi_mesh::Cell &cell, unsigned int node, const UnknownManager &unknown_manager, unsigned int unknown_id, unsigned int component) const =0 |
virtual int64_t | MapDOFLocal (const chi_mesh::Cell &cell, unsigned int node, const UnknownManager &unknown_manager, unsigned int unknown_id, unsigned int component) const =0 |
virtual int64_t | MapDOF (const chi_mesh::Cell &cell, unsigned int node) const =0 |
virtual int64_t | MapDOFLocal (const chi_mesh::Cell &cell, unsigned int node) const =0 |
size_t | GetNumLocalDOFs (const UnknownManager &unknown_manager) const |
size_t | GetNumGlobalDOFs (const UnknownManager &unknown_manager) const |
virtual size_t | GetNumGhostDOFs (const UnknownManager &unknown_manager) const =0 |
virtual std::vector< int64_t > | GetGhostDOFIndices (const UnknownManager &unknown_manager) const =0 |
size_t | GetNumLocalAndGhostDOFs (const UnknownManager &unknown_manager) const |
size_t | GetCellNumNodes (const chi_mesh::Cell &cell) const |
const std::vector< chi_mesh::Vector3 > & | GetCellNodeLocations (const chi_mesh::Cell &cell) const |
std::vector< std::vector< std::vector< int > > > | MakeInternalFaceNodeMappings (double tolerance=1.0e-12) const |
For each local cell, for each face, for each face-node, provides a mapping to the adjacent cell's nodes. More... | |
void | CopyVectorWithUnknownScope (const std::vector< double > &from_vector, std::vector< double > &to_vector, const UnknownManager &from_vec_uk_structure, unsigned int from_vec_uk_id, const UnknownManager &to_vec_uk_structure, unsigned int to_vec_uk_id) const |
virtual void | LocalizePETScVector (Vec petsc_vector, std::vector< double > &local_vector, const UnknownManager &unknown_manager) const |
virtual void | LocalizePETScVectorWithGhosts (Vec petsc_vector, std::vector< double > &local_vector, const UnknownManager &unknown_manager) const |
SpatialWeightFunction | GetSpatialWeightingFunction () const |
virtual | ~SpatialDiscretization ()=default |
Static Public Member Functions | |
static double | CartesianSpatialWeightFunction (const chi_mesh::Vector3 &point) |
static double | CylindricalRZSpatialWeightFunction (const chi_mesh::Vector3 &point) |
static double | Spherical1DSpatialWeightFunction (const chi_mesh::Vector3 &point) |
Data Fields | |
const UnknownManager | UNITARY_UNKNOWN_MANAGER |
Protected Types | |
typedef SpatialDiscretizationType | SDMType |
Protected Member Functions | |
SpatialDiscretization (const chi_mesh::MeshContinuum &grid, CoordinateSystemType cs_type, SDMType sdm_type) | |
Protected Attributes | |
const chi_mesh::MeshContinuum & | ref_grid_ |
std::vector< std::unique_ptr< CellMapping > > | cell_mappings_ |
std::map< uint64_t, std::shared_ptr< CellMapping > > | nb_cell_mappings_ |
uint64_t | local_block_address_ = 0 |
std::vector< uint64_t > | locJ_block_address_ |
std::vector< uint64_t > | locJ_block_size_ |
uint64_t | local_base_block_size_ = 0 |
uint64_t | globl_base_block_size_ = 0 |
const CoordinateSystemType | coord_sys_type_ |
Private Attributes | |
const SpatialDiscretizationType | type_ |
Definition at line 18 of file SpatialDiscretization.h.
|
protected |
Definition at line 152 of file SpatialDiscretization.h.
typedef std::function<double(const chi_mesh::Vector3&)> chi_math::SpatialDiscretization::SpatialWeightFunction |
Definition at line 143 of file SpatialDiscretization.h.
|
virtualdefault |
|
protected |
Definition at line 11 of file SpatialDiscretization.cc.
|
pure virtual |
Builds the sparsity pattern for a local block matrix compatible with the given unknown manager. The modified vectors are: nodal_nnz_in_diag
which specifies for each row the number of non-zeros in the local diagonal block, nodal_nnz_off_diag
which specifies for each row the number of non-zeros in the off-diagonal block.
Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.
|
static |
Cartesian coordinate system spatial weighting function.
Definition at line 304 of file SpatialDiscretization.cc.
void chi_math::SpatialDiscretization::CopyVectorWithUnknownScope | ( | const std::vector< double > & | from_vector, |
std::vector< double > & | to_vector, | ||
const UnknownManager & | from_vec_uk_structure, | ||
unsigned int | from_vec_uk_id, | ||
const UnknownManager & | to_vec_uk_structure, | ||
unsigned int | to_vec_uk_id | ||
) | const |
Copies DOFs from the from_vector to the to_vector, however, both vectors have the unknown-structure specified, and the given from_vec_uk_id is copied to the to_vec_uk_id.
Copy part of vector A to vector B. Suppose vector A's entries are managed chi_math::UnknownManager
A (uk_manA
) and that the entries of the vector B are managed by chi_math::UnknownManager
B (uk_manB
). This function copies the entries associated with an unknown with id uk_id_A
in uk_manA
from vector A to vector B such that the entries in vector B are aligned with the entries of an unknown with id uk_id_B
in uk_manB
. All the components are copied.
from_vector | Vector to copy from. |
to_vector | Vector to copy to. |
from_vec_uk_structure | Unknown manager for vector A. |
from_vec_uk_id | Unknown-id in unknown manager A. |
to_vec_uk_structure | Unknown manager for vector B. |
to_vec_uk_id | Unknown-id in unknown manager B. |
Definition at line 227 of file SpatialDiscretization.cc.
|
static |
Cylindrical coordinate system (RZ) spatial weighting function.
Definition at line 310 of file SpatialDiscretization.cc.
const CellMapping & chi_math::SpatialDiscretization::GetCellMapping | ( | const chi_mesh::Cell & | cell | ) | const |
Definition at line 23 of file SpatialDiscretization.cc.
const std::vector< chi_mesh::Vector3 > & chi_math::SpatialDiscretization::GetCellNodeLocations | ( | const chi_mesh::Cell & | cell | ) | const |
For the given cell, returns a reference to the relevant node locations. The same can be achieved by retrieving the cell-to-element mapping first.
Definition at line 81 of file SpatialDiscretization.cc.
size_t chi_math::SpatialDiscretization::GetCellNumNodes | ( | const chi_mesh::Cell & | cell | ) | const |
For the given cell, returns the number of relevant nodes. The same can be achieved by retrieving the cell-to-element mapping first.
Definition at line 75 of file SpatialDiscretization.cc.
CoordinateSystemType chi_math::SpatialDiscretization::GetCoordinateSystemType | ( | ) | const |
Definition at line 48 of file SpatialDiscretization.cc.
|
pure virtual |
For the unknown structure in the unknown manager, returns the global IDs of all the ghost degrees-of-freedom.
Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.
|
pure virtual |
For the unknown structure in the unknown manager, returns the number of ghost degrees-of-freedom.
Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.
size_t chi_math::SpatialDiscretization::GetNumGlobalDOFs | ( | const UnknownManager & | unknown_manager | ) | const |
For the unknown structure in the unknown manager, returns the number of global degrees-of-freedom.
Definition at line 61 of file SpatialDiscretization.cc.
size_t chi_math::SpatialDiscretization::GetNumLocalAndGhostDOFs | ( | const UnknownManager & | unknown_manager | ) | const |
For the unknown structure in the unknown manager, returns the number of local- and ghost degrees-of-freedom.
Definition at line 69 of file SpatialDiscretization.cc.
size_t chi_math::SpatialDiscretization::GetNumLocalDOFs | ( | const UnknownManager & | unknown_manager | ) | const |
For the unknown structure in the unknown manager, returns the number of local degrees-of-freedom.
Definition at line 53 of file SpatialDiscretization.cc.
SpatialDiscretization::SpatialWeightFunction chi_math::SpatialDiscretization::GetSpatialWeightingFunction | ( | ) | const |
Returns the spatial weighting function appropriate to the discretization's coordinate system.
Definition at line 324 of file SpatialDiscretization.cc.
const chi_mesh::MeshContinuum & chi_math::SpatialDiscretization::Grid | ( | ) | const |
Returns the reference grid on which this discretization is based.
Definition at line 43 of file SpatialDiscretization.cc.
|
virtual |
Develops a localized view of a petsc vector. Each spatial discretization can have a specialization of this method.
Develops a localized view of a petsc vector.
Definition at line 280 of file SpatialDiscretization.cc.
|
virtual |
Develops a localized view of a petsc vector. Each spatial discretization can have a specialization of this method.
Develops a localized view of a petsc vector.
Definition at line 293 of file SpatialDiscretization.cc.
std::pair< std::set< uint32_t >, std::set< uint32_t > > chi_math::SpatialDiscretization::MakeCellInternalAndBndryNodeIDs | ( | const chi_mesh::Cell & | cell | ) | const |
Utility method for getting node indices seperately for domain internal local nodes, and boundary nodes.
Definition at line 87 of file SpatialDiscretization.cc.
std::vector< std::vector< std::vector< int > > > chi_math::SpatialDiscretization::MakeInternalFaceNodeMappings | ( | double | tolerance = 1.0e-12 | ) | const |
For each local cell, for each face, for each face-node, provides a mapping to the adjacent cell's nodes.
For each cell, for each face of that cell, for each node on that face, maps to which local node on the adjacent cell that node position corresponds.
tolerance | double. Tolerance to use to determine if two node locations are equal. [Default: 1.0e-12] |
For example consider two adjacent quadrilaterals.
o--------o--------o o--------o |3 2|3 2| | 2 | | 101 | 102 | , face ids for both: |3 1| |0 1|0 1| | 0 | o--------o--------o o--------o internal face for cell 101 is face-1, ccw orientated --o 1| | 0| --o internal face for cell 102 is face-3, ccw orientated o- |0 | |1 o- mapping[101][1][0] = 0 mapping[101][1][1] = 3 mapping[102][3][0] = 2 mapping[102][3][1] = 1
Definition at line 153 of file SpatialDiscretization.cc.
|
pure virtual |
Maps the local address of a degree of freedom. This can include ghost entries if the specific discretization has any. Default structure here is a single scalar unknown.
Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.
|
pure virtual |
Maps the global address of a degree of freedom.
Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.
|
pure virtual |
Maps the local address of a degree of freedom. This can include ghost entries if the specific discretization has any. Default structure here is a single scalar unknown.
Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.
|
pure virtual |
Maps the local address of a degree of freedom. This can include ghost entries if the specific discretization has any.
Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.
|
static |
Spherical coordinate system (1D Spherical) spatial weighting function.
Definition at line 316 of file SpatialDiscretization.cc.
SpatialDiscretizationType chi_math::SpatialDiscretization::Type | ( | ) | const |
Definition at line 41 of file SpatialDiscretization.cc.
|
protected |
Definition at line 159 of file SpatialDiscretization.h.
|
protected |
Definition at line 169 of file SpatialDiscretization.h.
|
protected |
Definition at line 167 of file SpatialDiscretization.h.
|
protected |
Definition at line 166 of file SpatialDiscretization.h.
|
protected |
Definition at line 162 of file SpatialDiscretization.h.
|
protected |
Definition at line 163 of file SpatialDiscretization.h.
|
protected |
Definition at line 164 of file SpatialDiscretization.h.
|
protected |
Definition at line 160 of file SpatialDiscretization.h.
|
protected |
Definition at line 158 of file SpatialDiscretization.h.
|
private |
Definition at line 172 of file SpatialDiscretization.h.
const UnknownManager chi_math::SpatialDiscretization::UNITARY_UNKNOWN_MANAGER |
Definition at line 21 of file SpatialDiscretization.h.