1#ifndef included_AMP_DiffusionFD
2#define included_AMP_DiffusionFD
5#include "AMP/discretization/boxMeshDOFManager.h"
6#include "AMP/geometry/Geometry.h"
7#include "AMP/geometry/shapes/Box.h"
8#include "AMP/matrices/MatrixBuilder.h"
9#include "AMP/mesh/Mesh.h"
10#include "AMP/mesh/MeshID.h"
11#include "AMP/mesh/structured/BoxMesh.h"
12#include "AMP/operators/LinearOperator.h"
13#include "AMP/operators/Operator.h"
14#include "AMP/utils/ArraySize.h"
15#include "AMP/vectors/Vector.h"
16#include "AMP/vectors/VectorBuilder.h"
17#include "ProfilerApp.h"
55 size_t d_dim =
static_cast<size_t>( -1 );
58 std::shared_ptr<AMP::Mesh::BoxMesh>
d_BoxMesh =
nullptr;
64 std::vector<double>
d_h;
68 std::shared_ptr<AMP::Database>
d_db;
69 std::shared_ptr<AMP::Discretization::boxMeshDOFManager>
d_DOFMan;
78 static std::unique_ptr<AMP::Operator::Operator>
79 create( std::shared_ptr<AMP::Operator::OperatorParameters> params )
81 return std::make_unique<DiffusionFDOperator>( params );
85 std::string
type()
const override {
return "DiffusionFDOperator"; }
106 std::shared_ptr<std::vector<double>>
d_stencil =
nullptr;
109 std::shared_ptr<AMP::Mesh::BoxMesh::Box>
d_localBox =
nullptr;
129 void getCSRData(
size_t row, std::vector<size_t> &cols, std::vector<double> &data );
137 std::vector<size_t> &cols,
138 std::vector<double> &data )
const;
Structure to identify a logical box.
std::shared_ptr< AMP::ArraySize > d_localArraySize
ArraySize of the local box.
size_t d_dim
Problem dimension.
DiffusionFDOperator(std::shared_ptr< const AMP::Operator::OperatorParameters > params_)
std::shared_ptr< std::vector< double > > d_stencil
FD coefficients.
std::shared_ptr< AMP::Database > d_db
const std::vector< double > & getMeshSize() const
void fillMatrixWithCSRData(std::shared_ptr< AMP::LinearAlgebra::Matrix > matrix)
std::vector< double > createStencil() const
void getCSRDataBoundary(size_t row, std::vector< size_t > &cols, std::vector< double > &data) const
std::shared_ptr< AMP::Discretization::boxMeshDOFManager > d_DOFMan
void fillVectorWithFunction(std::shared_ptr< AMP::LinearAlgebra::Vector > u, std::function< double(const AMP::Mesh::Point &)> fun) const
std::shared_ptr< AMP::LinearAlgebra::Matrix > createDiscretizationMatrix()
virtual ~DiffusionFDOperator()
std::array< int, 3 > DOFToGridInds(size_t dof) const
Get grid indices corresponding to the DOF.
std::shared_ptr< AMP::Mesh::BoxMesh::Box > d_localBox
Local grid index box w/ zero ghosts.
size_t gridIndsToDOF(std::array< int, 3 > ijk) const
Map from grid index ijk to the corresponding DOF.
std::array< size_t, 5 > d_ijk
Placeholder array of grid indices.
void getCSRData(size_t row, std::vector< size_t > &cols, std::vector< double > &data)
Pack cols+data vectors in given row.
AMP::Mesh::BoxMesh::Box getLocalNodeBox() const
Convert a local element box to a local node box.
std::string type() const override
Return the name of the operator.
AMP::Mesh::BoxMesh::Box getGlobalNodeBox() const
std::shared_ptr< AMP::Mesh::BoxMesh > d_BoxMesh
Mesh.
static constexpr auto VertexGeom
Convenience member.
std::vector< double > d_h
Mesh sizes, hx, hy, hz. We compute these based on the incoming mesh.
void getCSRDataInterior(std::array< size_t, 5 > &ijkLocal, size_t rowLocal, std::vector< size_t > &cols, std::vector< double > &data) const
std::shared_ptr< AMP::Mesh::BoxMesh::Box > d_globalBox
Global grid index box w/ zero ghosts.
static std::unique_ptr< AMP::Operator::Operator > create(std::shared_ptr< AMP::Operator::OperatorParameters > params)
std::shared_ptr< AMP::LinearAlgebra::Vector > createRHSVector(std::function< double(const AMP::Mesh::Point &)> PDESourceFun, std::function< double(const AMP::Mesh::Point &, int boundary_id)> boundaryFun)
std::shared_ptr< AMP::Operator::Operator > shared_ptr