diff --git a/opm/simulators/utils/GridDataOutput.cpp b/opm/simulators/utils/GridDataOutput.cpp index 1d6eaca53..0b66606c3 100644 --- a/opm/simulators/utils/GridDataOutput.cpp +++ b/opm/simulators/utils/GridDataOutput.cpp @@ -36,13 +36,13 @@ template using DV = DamarisOutput::DamarisVar; #define INSTANCE(part, ...) \ template class SimMeshDataAccessor<__VA_ARGS__, part>; \ template long SimMeshDataAccessor<__VA_ARGS__,part>:: \ - writeGridPoints>(DV&, DV&, DV&); \ + writeGridPoints>(DV&, DV&, DV&) const; \ template long SimMeshDataAccessor<__VA_ARGS__,part>:: \ - writeConnectivity>(DV&, ConnectivityVertexOrder); \ + writeConnectivity>(DV&, ConnectivityVertexOrder) const; \ template long SimMeshDataAccessor<__VA_ARGS__,part>:: \ - writeOffsetsCells>(DV&); \ + writeOffsetsCells>(DV&) const; \ template long SimMeshDataAccessor<__VA_ARGS__,part>:: \ - writeCellTypes>(DV&); + writeCellTypes>(DV&) const; INSTANCE(1, Dune::GridView>) diff --git a/opm/simulators/utils/GridDataOutput.hpp b/opm/simulators/utils/GridDataOutput.hpp index 1f205780c..548163847 100644 --- a/opm/simulators/utils/GridDataOutput.hpp +++ b/opm/simulators/utils/GridDataOutput.hpp @@ -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 - 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 - 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 - 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 - 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 - 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 - 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 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 - 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 - 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 - 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 - 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 - long writeCellTypes(VectType& types_inout); + long writeCellTypes(VectType& types_inout) const; - std::string getPartitionTypeString(); + std::string getPartitionTypeString() const; Dune::PartitionSet 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; diff --git a/opm/simulators/utils/GridDataOutput_impl.hpp b/opm/simulators/utils/GridDataOutput_impl.hpp index b02c912d3..8c211e621 100644 --- a/opm/simulators/utils/GridDataOutput_impl.hpp +++ b/opm/simulators/utils/GridDataOutput_impl.hpp @@ -42,7 +42,7 @@ SimMeshDataAccessor:: } template -bool SimMeshDataAccessor::polyhedralCellPresent() +bool SimMeshDataAccessor::polyhedralCellPresent() const { for (const auto& cit : elements(gridView_, dunePartition_)) { auto corner_geom = cit.geometry(); @@ -73,7 +73,7 @@ void SimMeshDataAccessor::countEntities() template template long SimMeshDataAccessor:: -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 template long SimMeshDataAccessor:: -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 template long SimMeshDataAccessor:: -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 template long SimMeshDataAccessor:: -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 template long SimMeshDataAccessor:: -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 template long SimMeshDataAccessor:: -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 template long SimMeshDataAccessor:: 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 template long SimMeshDataAccessor:: -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 template long SimMeshDataAccessor:: -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 template long SimMeshDataAccessor:: -writeOffsetsCells(VectType& offsets_inout) +writeOffsetsCells(VectType& offsets_inout) const { const std::size_t check_size = offsets_inout.size(); if (check_size < static_cast(ncells_)) { @@ -441,7 +442,7 @@ writeOffsetsCells(VectType& offsets_inout) template template long SimMeshDataAccessor:: -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 template long SimMeshDataAccessor:: -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 std::string SimMeshDataAccessor:: -getPartitionTypeString() +getPartitionTypeString() const { if (this->dunePartition_ == Dune::Partitions::all) return std::string("Dune::Partitions::all"); @@ -506,7 +507,7 @@ getPartitionTypeString() template void SimMeshDataAccessor:: -printGridDetails(std::ostream& outstr) +printGridDetails(std::ostream& outstr) const { outstr << "Dune Partition = " << partition_value_ << ", " << getPartitionTypeString() << std::endl; outstr << "ncells_: " << getNCells() << std::endl;