mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
GridDataOutput: add const correctness
This commit is contained in:
parent
26d3802ea6
commit
54c386ae2c
@ -36,13 +36,13 @@ template<class T> using DV = DamarisOutput::DamarisVar<T>;
|
||||
#define INSTANCE(part, ...) \
|
||||
template class SimMeshDataAccessor<__VA_ARGS__, part>; \
|
||||
template long SimMeshDataAccessor<__VA_ARGS__,part>:: \
|
||||
writeGridPoints<DV<double>>(DV<double>&, DV<double>&, DV<double>&); \
|
||||
writeGridPoints<DV<double>>(DV<double>&, DV<double>&, DV<double>&) const; \
|
||||
template long SimMeshDataAccessor<__VA_ARGS__,part>:: \
|
||||
writeConnectivity<DV<int>>(DV<int>&, ConnectivityVertexOrder); \
|
||||
writeConnectivity<DV<int>>(DV<int>&, ConnectivityVertexOrder) const; \
|
||||
template long SimMeshDataAccessor<__VA_ARGS__,part>:: \
|
||||
writeOffsetsCells<DV<int>>(DV<int>&); \
|
||||
writeOffsetsCells<DV<int>>(DV<int>&) const; \
|
||||
template long SimMeshDataAccessor<__VA_ARGS__,part>:: \
|
||||
writeCellTypes<DV<char>>(DV<char>&);
|
||||
writeCellTypes<DV<char>>(DV<char>&) const;
|
||||
|
||||
INSTANCE(1, Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>)
|
||||
|
||||
|
@ -138,7 +138,7 @@ public:
|
||||
partition is not going to be available for visualisation as this class does
|
||||
not yet handle polyhedral cells.
|
||||
*/
|
||||
bool polyhedralCellPresent();
|
||||
bool polyhedralCellPresent() const;
|
||||
|
||||
/**
|
||||
Count the vertices, cells and corners.
|
||||
@ -162,7 +162,7 @@ public:
|
||||
Returns the number of vertices written
|
||||
*/
|
||||
template <typename T>
|
||||
long writeGridPoints(T* x_inout, T* y_inout, T* z_inout, long max_size = 0);
|
||||
long writeGridPoints(T* x_inout, T* y_inout, T* z_inout, long max_size = 0) const;
|
||||
|
||||
/**
|
||||
Write the positions of vertices - directly to the pointers given in
|
||||
@ -178,7 +178,7 @@ public:
|
||||
Returns the number of vertices written
|
||||
*/
|
||||
template <typename VectType>
|
||||
long writeGridPoints(VectType& x_inout, VectType& y_inout, VectType& z_inout);
|
||||
long writeGridPoints(VectType& x_inout, VectType& y_inout, VectType& z_inout) const;
|
||||
|
||||
/**
|
||||
Write the positions of vertices - directly to the pointers given in
|
||||
@ -191,7 +191,7 @@ public:
|
||||
Returns the number of vertices written
|
||||
*/
|
||||
template <typename T>
|
||||
long writeGridPoints_AOS(T* xyz_inout, long max_size = 0);
|
||||
long writeGridPoints_AOS(T* xyz_inout, long max_size = 0) const;
|
||||
|
||||
/**
|
||||
Write the positions of vertices - directly to the pointers given in
|
||||
@ -203,7 +203,7 @@ public:
|
||||
Returns the number of vertices written
|
||||
*/
|
||||
template <typename VectType>
|
||||
long writeGridPoints_AOS(VectType& xyz_inout);
|
||||
long writeGridPoints_AOS(VectType& xyz_inout) const;
|
||||
|
||||
/**
|
||||
Write the positions of vertices - directly to the pointers given in
|
||||
@ -216,7 +216,7 @@ public:
|
||||
Returns the number of vertices written
|
||||
*/
|
||||
template <typename T>
|
||||
long writeGridPoints_SOA(T* xyz_inout, long max_size = 0);
|
||||
long writeGridPoints_SOA(T* xyz_inout, long max_size = 0) const;
|
||||
|
||||
/**
|
||||
Write the positions of vertices - directly to the pointers given in
|
||||
@ -228,7 +228,7 @@ public:
|
||||
Returns the number of vertices written
|
||||
*/
|
||||
template <typename VectType>
|
||||
long writeGridPoints_SOA(VectType& xyz_inout);
|
||||
long writeGridPoints_SOA(VectType& xyz_inout) const;
|
||||
|
||||
/**
|
||||
* Write the connectivity array - directly to the pointer given in parameter 1
|
||||
@ -243,7 +243,7 @@ public:
|
||||
*/
|
||||
template <typename Integer>
|
||||
long writeConnectivity(Integer* connectivity_inout,
|
||||
ConnectivityVertexOrder whichOrder, long max_size = 0);
|
||||
ConnectivityVertexOrder whichOrder, long max_size = 0) const;
|
||||
|
||||
/**
|
||||
* Write the connectivity array - directly to a VectType object given in parameter 1
|
||||
@ -258,7 +258,8 @@ public:
|
||||
Returns the number of corner indices written.
|
||||
*/
|
||||
template <typename VectType>
|
||||
long writeConnectivity(VectType& connectivity_inout, ConnectivityVertexOrder whichOrder);
|
||||
long writeConnectivity(VectType& connectivity_inout,
|
||||
ConnectivityVertexOrder whichOrder) const;
|
||||
|
||||
/**
|
||||
* Write the offsets values - directly to the pointer given in parameter 1
|
||||
@ -272,7 +273,7 @@ public:
|
||||
Returns number of offset values written + 1
|
||||
*/
|
||||
template <typename Integer>
|
||||
long writeOffsetsCells(Integer* offsets_inout, long max_size = 0);
|
||||
long writeOffsetsCells(Integer* offsets_inout, long max_size = 0) const;
|
||||
|
||||
/**
|
||||
* Write the offsets values - directly to a VectType object given in parameter 1
|
||||
@ -285,7 +286,7 @@ public:
|
||||
Returns number of offset values written + 1
|
||||
*/
|
||||
template <typename VectType>
|
||||
long writeOffsetsCells(VectType& offsets_inout);
|
||||
long writeOffsetsCells(VectType& offsets_inout) const;
|
||||
|
||||
/**
|
||||
* Write the cell types values - directly to the pointer given in parameter 1
|
||||
@ -298,7 +299,7 @@ public:
|
||||
Returns number of cells type values written
|
||||
*/
|
||||
template <typename Integer>
|
||||
long writeCellTypes(Integer* types_inout, long max_size = 0);
|
||||
long writeCellTypes(Integer* types_inout, long max_size = 0) const;
|
||||
|
||||
/**
|
||||
* Write the cell types values - directly to the VectType object given in parameter 1
|
||||
@ -309,33 +310,33 @@ public:
|
||||
Returns number of cells type values written
|
||||
*/
|
||||
template <typename VectType>
|
||||
long writeCellTypes(VectType& types_inout);
|
||||
long writeCellTypes(VectType& types_inout) const;
|
||||
|
||||
std::string getPartitionTypeString();
|
||||
std::string getPartitionTypeString() const;
|
||||
|
||||
Dune::PartitionSet<partitions> getPartition(void)
|
||||
{
|
||||
return this->dunePartition_;
|
||||
}
|
||||
|
||||
void printGridDetails(std::ostream& outstr);
|
||||
void printGridDetails(std::ostream& outstr) const;
|
||||
|
||||
int getNCells()
|
||||
int getNCells() const
|
||||
{
|
||||
return ncells_;
|
||||
}
|
||||
|
||||
int getNVertices()
|
||||
int getNVertices() const
|
||||
{
|
||||
return nvertices_;
|
||||
}
|
||||
|
||||
int getNCorners()
|
||||
int getNCorners() const
|
||||
{
|
||||
return ncorners_;
|
||||
}
|
||||
|
||||
std::string getError()
|
||||
std::string getError() const
|
||||
{
|
||||
return error_strm_.str();
|
||||
}
|
||||
@ -345,7 +346,7 @@ public:
|
||||
error_strm_.str("");
|
||||
}
|
||||
|
||||
bool hasError()
|
||||
bool hasError() const
|
||||
{
|
||||
if (error_strm_.str().length() > 0)
|
||||
return true;
|
||||
|
@ -42,7 +42,7 @@ SimMeshDataAccessor<GridView,partitions>::
|
||||
}
|
||||
|
||||
template <class GridView, unsigned int partitions>
|
||||
bool SimMeshDataAccessor<GridView,partitions>::polyhedralCellPresent()
|
||||
bool SimMeshDataAccessor<GridView,partitions>::polyhedralCellPresent() const
|
||||
{
|
||||
for (const auto& cit : elements(gridView_, dunePartition_)) {
|
||||
auto corner_geom = cit.geometry();
|
||||
@ -73,7 +73,7 @@ void SimMeshDataAccessor<GridView,partitions>::countEntities()
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename T>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeGridPoints(T* x_inout, T* y_inout, T* z_inout, long max_size)
|
||||
writeGridPoints(T* x_inout, T* y_inout, T* z_inout, long max_size) const
|
||||
{
|
||||
if (max_size < nvertices_) {
|
||||
OPM_THROW(std::runtime_error,
|
||||
@ -109,7 +109,7 @@ writeGridPoints(T* x_inout, T* y_inout, T* z_inout, long max_size)
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename VectType>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeGridPoints(VectType& x_inout, VectType& y_inout, VectType& z_inout)
|
||||
writeGridPoints(VectType& x_inout, VectType& y_inout, VectType& z_inout) const
|
||||
{
|
||||
const std::size_t check_size_x = x_inout.size();
|
||||
const std::size_t check_size_y = y_inout.size();
|
||||
@ -156,7 +156,7 @@ writeGridPoints(VectType& x_inout, VectType& y_inout, VectType& z_inout)
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename T>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeGridPoints_AOS(T* xyz_inout, long max_size)
|
||||
writeGridPoints_AOS(T* xyz_inout, long max_size) const
|
||||
{
|
||||
if (max_size < nvertices_ * 3) {
|
||||
assert(max_size >= nvertices_ * 3);
|
||||
@ -188,7 +188,7 @@ writeGridPoints_AOS(T* xyz_inout, long max_size)
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename VectType>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeGridPoints_AOS(VectType& xyz_inout)
|
||||
writeGridPoints_AOS(VectType& xyz_inout) const
|
||||
{
|
||||
const std::size_t check_size = xyz_inout.size();
|
||||
|
||||
@ -226,7 +226,7 @@ writeGridPoints_AOS(VectType& xyz_inout)
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename T>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeGridPoints_SOA(T* xyz_inout, long max_size)
|
||||
writeGridPoints_SOA(T* xyz_inout, long max_size) const
|
||||
{
|
||||
if (max_size < nvertices_ * 3) {
|
||||
// assert(max_size >= nvertices_ * 3);
|
||||
@ -264,7 +264,7 @@ writeGridPoints_SOA(T* xyz_inout, long max_size)
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename VectType>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeGridPoints_SOA(VectType& xyz_inout)
|
||||
writeGridPoints_SOA(VectType& xyz_inout) const
|
||||
{
|
||||
const std::size_t check_size = xyz_inout.size();
|
||||
|
||||
@ -309,7 +309,7 @@ template <class GridView, unsigned int partitions>
|
||||
template <typename Integer>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeConnectivity(Integer* connectivity_inout,
|
||||
ConnectivityVertexOrder whichOrder, long max_size)
|
||||
ConnectivityVertexOrder whichOrder, long max_size) const
|
||||
{
|
||||
if (max_size < ncorners_) {
|
||||
|
||||
@ -349,7 +349,8 @@ writeConnectivity(Integer* connectivity_inout,
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename VectType>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeConnectivity(VectType& connectivity_inout, ConnectivityVertexOrder whichOrder)
|
||||
writeConnectivity(VectType& connectivity_inout,
|
||||
ConnectivityVertexOrder whichOrder) const
|
||||
{
|
||||
const std::size_t check_size = connectivity_inout.size();
|
||||
|
||||
@ -392,7 +393,7 @@ writeConnectivity(VectType& connectivity_inout, ConnectivityVertexOrder whichOrd
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename Integer>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeOffsetsCells(Integer* offsets_inout, long max_size)
|
||||
writeOffsetsCells(Integer* offsets_inout, long max_size) const
|
||||
{
|
||||
if (max_size < ncells_) {
|
||||
// assert(max_size >= ncells_);
|
||||
@ -414,7 +415,7 @@ writeOffsetsCells(Integer* offsets_inout, long max_size)
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename VectType>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeOffsetsCells(VectType& offsets_inout)
|
||||
writeOffsetsCells(VectType& offsets_inout) const
|
||||
{
|
||||
const std::size_t check_size = offsets_inout.size();
|
||||
if (check_size < static_cast<std::size_t>(ncells_)) {
|
||||
@ -441,7 +442,7 @@ writeOffsetsCells(VectType& offsets_inout)
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename Integer>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeCellTypes(Integer* types_inout, long max_size)
|
||||
writeCellTypes(Integer* types_inout, long max_size) const
|
||||
{
|
||||
if (max_size < ncells_) {
|
||||
// assert(max_size >= ncells_);
|
||||
@ -461,7 +462,7 @@ writeCellTypes(Integer* types_inout, long max_size)
|
||||
template <class GridView, unsigned int partitions>
|
||||
template <typename VectType>
|
||||
long SimMeshDataAccessor<GridView,partitions>::
|
||||
writeCellTypes(VectType& types_inout)
|
||||
writeCellTypes(VectType& types_inout) const
|
||||
{
|
||||
const std::size_t check_size = types_inout.size();
|
||||
|
||||
@ -482,7 +483,7 @@ writeCellTypes(VectType& types_inout)
|
||||
|
||||
template <class GridView, unsigned int partitions>
|
||||
std::string SimMeshDataAccessor<GridView,partitions>::
|
||||
getPartitionTypeString()
|
||||
getPartitionTypeString() const
|
||||
{
|
||||
if (this->dunePartition_ == Dune::Partitions::all)
|
||||
return std::string("Dune::Partitions::all");
|
||||
@ -506,7 +507,7 @@ getPartitionTypeString()
|
||||
|
||||
template <class GridView, unsigned int partitions>
|
||||
void SimMeshDataAccessor<GridView,partitions>::
|
||||
printGridDetails(std::ostream& outstr)
|
||||
printGridDetails(std::ostream& outstr) const
|
||||
{
|
||||
outstr << "Dune Partition = " << partition_value_ << ", " << getPartitionTypeString() << std::endl;
|
||||
outstr << "ncells_: " << getNCells() << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user