25#ifndef __BITPIT_VOLCARTESIAN_HPP__
26#define __BITPIT_VOLCARTESIAN_HPP__
33#include "bitpit_patchkernel.hpp"
51 VolCartesian(
int dimension,
const std::array<double, 3> &origin,
52 const std::array<double, 3> &lengths,
const std::array<int, 3> &nCells);
53 VolCartesian(
int id,
int dimension,
const std::array<double, 3> &origin,
54 const std::array<double, 3> &lengths,
const std::array<int, 3> &nCells);
55 VolCartesian(
int dimension,
const std::array<double, 3> &origin,
56 double length,
int nCells1D);
57 VolCartesian(
int id,
int dimension,
const std::array<double, 3> &origin,
58 double length,
int nCells1D);
59 VolCartesian(
int dimension,
const std::array<double, 3> &origin,
60 double length,
double dh);
61 VolCartesian(
int id,
int dimension,
const std::array<double, 3> &origin,
62 double length,
double dh);
65 std::unique_ptr<PatchKernel>
clone()
const override;
67 void reset()
override;
89 double evalCellVolume(
const std::array<int, 3> &ijk)
const;
91 double evalCellSize(
const std::array<int, 3> &ijk)
const;
96 void evalCellBoundingBox(
long id, std::array<double,3> *minPoint, std::array<double,3> *maxPoint)
const override;
107 bool isPointInside(
const std::array<double, 3> &point)
const override;
108 bool isPointInside(
long id,
const std::array<double, 3> &point)
const override;
109 long locatePoint(
const std::array<double, 3> &point)
const override;
116 std::vector<long>
extractCellSubSet(std::array<int, 3>
const &ijkMin, std::array<int, 3>
const &ijkMax)
const;
118 std::vector<long>
extractCellSubSet(std::array<double, 3>
const &pointMin, std::array<double, 3>
const &pointMax)
const;
119 std::vector<long>
extractVertexSubSet(std::array<int, 3>
const &ijkMin, std::array<int, 3>
const &ijkMax)
const;
121 std::vector<long>
extractVertexSubSet(std::array<double, 3>
const &pointMin, std::array<double, 3>
const &pointMax)
const;
124 void setOrigin(
const std::array<double, 3> &origin);
125 void translate(
const std::array<double, 3> &translation)
override;
126 void rotate(
const std::array<double, 3> &n0,
const std::array<double, 3> &n1,
double angle)
override;
128 void setLengths(
const std::array<double, 3> &lengths);
129 void scale(
const std::array<double, 3> &scaling,
const std::array<double, 3> ¢er)
override;
132 std::vector<double>
convertToCellData(
const std::vector<double> &vertexData)
const;
134 int linearCellInterpolation(
const std::array<double,3> &point, std::vector<int> *stencil, std::vector<double> *weights)
const;
135 int linearVertexInterpolation(
const std::array<double,3> &point, std::vector<int> *stencil, std::vector<double> *weights)
const;
157 void _dump(std::ostream &stream)
const override;
158 void _restore(std::istream &stream)
override;
160 void _findCellFaceNeighs(
long id,
int face,
const std::vector<long> *blackList, std::vector<long> *neighs)
const override;
161 void _findCellEdgeNeighs(
long id,
int edge,
const std::vector<long> *blackList, std::vector<long> *neighs)
const override;
162 void _findCellVertexNeighs(
long id,
int vertex,
const std::vector<long> *blackList, std::vector<long> *neighs)
const override;
165 MemoryMode m_memoryMode;
167 std::array<double, 3> m_cellSpacings;
168 std::array<double, 3> m_minCoords;
169 std::array<double, 3> m_maxCoords;
171 std::array<int, 3> m_directionOrdering;
173 std::array<std::vector<double>, 3> m_vertexCoords;
174 std::array<std::vector<double>, 3> m_cellCenters;
176 std::array<int, 3> m_nCells1D;
177 std::array<int, 3> m_nVertices1D;
185 std::array<double, 3> m_interfaceArea;
186 std::array<std::array<double, 3>, 6> m_normals;
188 std::vector<std::array<int, 3>> m_vertexNeighDeltas;
189 std::vector<std::array<int, 3>> m_edgeNeighDeltas;
190 std::vector<std::array<int, 2>> m_edgeFaces;
193 void initializeInterfaceArea();
194 void initializeCellVolume();
195 void initializeCellSize();
197 void setDiscretization(
const std::array<int, 3> &nCells);
199 void setMemoryMode(MemoryMode mode);
205 double evalCellVolume()
const;
206 double evalCellSize()
const;
virtual ElementType getInterfaceType(long id) const
long locatePoint(double x, double y, double z) const
virtual ElementType getCellType(long id) const
The VolCartesian defines a Cartesian patch.
void _findCellVertexNeighs(long id, int vertex, const std::vector< long > *blackList, std::vector< long > *neighs) const override
std::array< double, 3 > getLengths() const
std::array< int, 3 > getCellFaceNeighsCartesianId(long id, int face) const
long getCellLinearId(int i, int j, int k) const
double evalCellSize(long id) const override
std::array< double, 3 > evalInterfaceNormal(long id) const override
long getCellFaceNeighsLinearId(long id, int face) const
long getInterfaceCount() const override
void setLengths(const std::array< double, 3 > &lengths)
void resetInterfaces() override
void setOrigin(const std::array< double, 3 > &origin)
bool isPointInside(const std::array< double, 3 > &point) const override
void evalCellBoundingBox(long id, std::array< double, 3 > *minPoint, std::array< double, 3 > *maxPoint) const override
std::vector< long > extractVertexSubSet(std::array< int, 3 > const &ijkMin, std::array< int, 3 > const &ijkMax) const
long locateClosestCell(std::array< double, 3 > const &point) const
std::vector< long > extractCellSubSet(std::array< int, 3 > const &ijkMin, std::array< int, 3 > const &ijkMax) const
std::array< int, 3 > locatePointCartesian(const std::array< double, 3 > &point) const
std::array< int, 3 > locateClosestVertexCartesian(std::array< double, 3 > const &point) const
long locateClosestVertex(std::array< double, 3 > const &point) const
long getCellCount() const override
std::unique_ptr< PatchKernel > clone() const override
std::array< double, 3 > getOrigin() const
void rotate(const std::array< double, 3 > &n0, const std::array< double, 3 > &n1, double angle) override
double evalCellVolume(long id) const override
void _updateAdjacencies() override
std::array< int, 3 > locateClosestCellCartesian(std::array< double, 3 > const &point) const
ElementType getCellType() const
std::array< double, 3 > evalCellCentroid(long id) const override
int _getDumpVersion() const override
bool isVertexCartesianIdValid(const std::array< int, 3 > &ijk) const
std::array< int, 3 > getVertexCartesianId(long id) const
ElementType getInterfaceType() const
long locatePoint(const std::array< double, 3 > &point) const override
const std::vector< double > & getVertexCoords(int direction) const
long getVertexCount() const override
std::vector< double > convertToCellData(const std::vector< double > &vertexData) const
double evalInterfaceArea(long id) const override
void _findCellFaceNeighs(long id, int face, const std::vector< long > *blackList, std::vector< long > *neighs) const override
std::array< int, 3 > getCellCartesianId(long id) const
std::vector< double > convertToVertexData(const std::vector< double > &cellData) const
bool isCellCartesianIdValid(const std::array< int, 3 > &ijk) const
void switchMemoryMode(MemoryMode mode)
int linearCellInterpolation(const std::array< double, 3 > &point, std::vector< int > *stencil, std::vector< double > *weights) const
void _updateInterfaces() override
void _findCellEdgeNeighs(long id, int edge, const std::vector< long > *blackList, std::vector< long > *neighs) const override
int linearVertexInterpolation(const std::array< double, 3 > &point, std::vector< int > *stencil, std::vector< double > *weights) const
long getVertexLinearId(int i, int j, int k) const
void translate(const std::array< double, 3 > &translation) override
const std::vector< double > & getCellCentroids(int direction) const
std::array< double, 3 > evalVertexCoords(long id) const
std::array< double, 3 > getSpacing() const
void _dump(std::ostream &stream) const override
void _restore(std::istream &stream) override
void scale(const std::array< double, 3 > &scaling, const std::array< double, 3 > ¢er) override
MemoryMode getMemoryMode() const
The VolumeKernel class provides an interface for defining volume patches.
bool isPointInside(double x, double y, double z) const