From d10c0349b032bae0f9086577549beda87cf71e8f Mon Sep 17 00:00:00 2001 From: Ilhan Özgen Xian Date: Wed, 8 Sep 2021 13:46:09 -0700 Subject: add capability to differentiate between surface and subsurface mesh group --- header.hpp | 7 +++++-- makefile | 4 ++-- mesh.hpp | 16 ++++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/header.hpp b/header.hpp index d4f7e00..ae824fe 100644 --- a/header.hpp +++ b/header.hpp @@ -27,8 +27,11 @@ #define INFILTRATE_TRUE 1 #define INFILTRATE_FALSE 2 -#define MESH_MIXED_ELEMENTS "/0/Mesh/MixedElements" -#define MESH_NODES "/0/Mesh/Nodes" +#define SURFACE_MESH_MIXED_ELEMENTS "/0/Mesh/MixedElements" +#define SURFACE_MESH_NODES "/0/Mesh/Nodes" + +#define SUBSURFACE_MESH_MIXED_ELEMENTS "/77/Mesh/MixedElements" +#define SUBSURFACE_MESH_NODES "/77/Mesh/Nodes" #define SURFACE_EXCHANGE_FLUX "surface-surface_subsurface_flux.cell.0" #define SURFACE_WATER_DEPTH "surface-ponded_depth.cell.0" diff --git a/makefile b/makefile index c0ff9e3..08d9972 100644 --- a/makefile +++ b/makefile @@ -1,10 +1,10 @@ PRG=ptracker -CC=g++-11 +CC=g++ #CC=mpic++ CXXFLAGS=-Wall -Wextra -pedantic -O0 -fopenmp #LFLAGS=-I/home/iozgen/Documents/software/hdf5/include -L/home/iozgen/Documents/software/hdf5/lib -LFLAGS=-I/opt/hdf5/include -L/opt/hdf5/lib +LFLAGS=-I/global/home/users/iozgen/stuff/hdf5/include -L/global/home/users/iozgen/stuff/hdf5/lib SRC=main.cpp LIB=-lm -lhdf5 -lhdf5_cpp OBJ=$(SRC:.cpp=.o) diff --git a/mesh.hpp b/mesh.hpp index 358b2b4..bbfa53c 100644 --- a/mesh.hpp +++ b/mesh.hpp @@ -65,11 +65,11 @@ public: std::cout << "[msh] surface mesh indexing" << std::endl; std::vector> node_indices; - read_node_indices(fp_surface, node_indices); + read_node_indices(fp_surface, node_indices, SURFACE_MESH_MIXED_ELEMENTS); n_vertices = node_indices[0].size(); std::vector nodes; - read_nodes(fp_surface, nodes); + read_nodes(fp_surface, nodes, SURFACE_MESH_NODES); initialise_surface(node_indices, nodes); @@ -82,10 +82,10 @@ public: for (size_t i = 0; i < node_indices.size(); i ++) node_indices[i].clear(); - read_node_indices(fp_subsurface, node_indices); + read_node_indices(fp_subsurface, node_indices, SUBSURFACE_MESH_MIXED_ELEMENTS); nodes.clear(); - read_nodes(fp_subsurface, nodes); + read_nodes(fp_subsurface, nodes, SUBSURFACE_MESH_NODES); // @@ -408,10 +408,10 @@ private: // --- // read the node indices from hdf5 file // --- - void read_node_indices(H5::H5File fp, std::vector> &node_indices) + void read_node_indices(H5::H5File fp, std::vector> &node_indices, std::string node_index_str) { - H5::DataSet dset = fp.openDataSet(MESH_MIXED_ELEMENTS); + H5::DataSet dset = fp.openDataSet(node_index_str.c_str()); H5::DataType dtype = dset.getDataType(); H5::DataSpace dspace = dset.getSpace(); @@ -455,10 +455,10 @@ private: // --- // read in the coordinates from the hdf5 file // --- - void read_nodes(H5::H5File fp, std::vector &nodes) + void read_nodes(H5::H5File fp, std::vector &nodes, std::string mesh_nodes_str) { - H5::DataSet dset = fp.openDataSet(MESH_NODES); + H5::DataSet dset = fp.openDataSet(mesh_nodes_str.c_str()); H5::DataType dtype = dset.getDataType(); H5::DataSpace dspace = dset.getSpace(); -- cgit v1.2.3-13-gbd6f