diff options
Diffstat (limited to 'new/mesh.cpp')
-rw-r--r-- | new/mesh.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/new/mesh.cpp b/new/mesh.cpp index 6ae6c22..8112ede 100644 --- a/new/mesh.cpp +++ b/new/mesh.cpp @@ -9,7 +9,6 @@ void Mesh::build_surface_mesh(H5::H5File fp, H5::H5File ep) { - std::cout << "[~>] Building the surface mesh" << std::endl; get_mesh_metadata(fp, SURFACE_NCOL); @@ -21,8 +20,6 @@ void Mesh::build_surface_mesh(H5::H5File fp, H5::H5File ep) void Mesh::build_subsurface_mesh(H5::H5File fp) { - - std::cout << "[~>] Building the subsurface mesh" << std::endl; get_mesh_metadata(fp, SUBSURFACE_NCOL); @@ -41,11 +38,9 @@ void Mesh::build_environment(H5::H5File ep, int flag) // Read in velocities in x direction if (flag == SUBSURFACE_FLAG) { - std::cout << "[~>] Building the subsurface environment" << std::endl; groupname = "darcy_velocity.cell.0"; datasetname = SUBSURFACE_DATA_GROUP_NAME_H5; } else if (flag == SURFACE_FLAG) { - std::cout << "[~>] Building the surface environment" << std::endl; groupname = "surface-velocity.cell.0"; datasetname = SURFACE_DATA_GROUP_NAME_H5; } @@ -85,17 +80,21 @@ void Mesh::build_environment(H5::H5File ep, int flag) // Rescale the exchange flux from mole to m/s for (int i = 0; i < n_cells_surface; i ++) { surface_cells[i].set_velocity(2, surface_cells[i].get_velocity(2) * 1.8e-5 * AREADIV); +#if VERBOSE if (i % (n_cells_surface / MAXPRINT) == 0) printf("[~~~~>] Surface velocity in cell[%d] = { %e, %e, %e } m/s\n", i, surface_cells[i].get_velocity(0), surface_cells[i].get_velocity(1), surface_cells[i].get_velocity(2)); +#endif } // Read in water depth read_water_depth(ep); - } else if (flag == SUBSURFACE_FLAG) { + } +#if VERBOSE + else if (flag == SUBSURFACE_FLAG) { for (int i = 0; i < n_cells_subsurface; i ++) { if (i % (n_cells_subsurface / MAXPRINT) == 0) @@ -106,6 +105,7 @@ void Mesh::build_environment(H5::H5File ep, int flag) } } +#endif } @@ -180,8 +180,10 @@ void Mesh::handle_surface_node_data(H5::H5File fp) hsize_t *dims_n = new hsize_t[rank]; dataspace_n.getSimpleExtentDims(dims_n); +#if VERBOSE for (int i = 0; i < rank; i ++) std::cout << "[~~~>] Dimension in " << i << " of nodes: " << dims_n[i] << std::endl; +#endif double *data_n = new double[dims_n[0]*dims_n[1]]; dataset_n.read(data_n, H5::PredType::IEEE_F64LE); @@ -208,8 +210,6 @@ void Mesh::build_surface_cells(H5::H5File ep) for (int i = 0; i < n_cells_surface; i ++) { - //std::cout << "build cell " << i << std::endl; - int n1 = element_node_indices[i][1]; int n2 = element_node_indices[i][2]; int n3 = element_node_indices[i][3]; @@ -282,11 +282,13 @@ void Mesh::build_surface_cells(H5::H5File ep) surface_cells[i].set_coupled_neighbor(coupled_neighbor); subsurface_cells[coupled_neighbor].set_coupled_neighbor(i); +#if VERBOSE if (i%(n_cells_surface/5)==0) { std::cout << "[~~~>] Coupling surface and subsurface meshes" << std::endl; std::cout << "[~~~~>] Subsurface neighbor of cell " << i << " is cell " << surface_cells[i].get_coupled_neighbor() << std::endl; std::cout << "[~~~~>] Surface neighbor of cell " << coupled_neighbor << " is cell " << subsurface_cells[coupled_neighbor].get_coupled_neighbor() << std::endl; } +#endif } @@ -304,9 +306,11 @@ void Mesh::handle_subsurface_node_data(H5::H5File fp) hsize_t *dims_n = new hsize_t[rank]; dataspace_n.getSimpleExtentDims(dims_n); +#if VERBOSE for (int i = 0; i < rank; i ++) std::cout << "[~~~>] Dimension in " << i << " of nodes: " << dims_n[i] << std::endl; - +#endif + double *data_n = new double[dims_n[0]*dims_n[1]]; dataset_n.read(data_n, H5::PredType::IEEE_F64LE); @@ -415,8 +419,10 @@ void Mesh::get_mesh_metadata(H5::H5File fp, int flag) hsize_t *dims_e = new hsize_t[rank]; dataspace_e.getSimpleExtentDims(dims_e); +#if VERBOSE for (int i = 0; i < rank; i ++) std::cout << "[~~~>] Dimension in " << i << " of element node map: " << dims_e[i] << std::endl; +#endif int *data_e = new int[dims_e[0]*dims_e[1]]; dataset_e.read(data_e, H5::PredType::STD_I32LE); @@ -439,8 +445,6 @@ void Mesh::get_mesh_metadata(H5::H5File fp, int flag) n_cells_surface = ny_e; surface_cells.resize(ny_e); } - - std::cout << "[~~~>] Number of cells: " << ny_e << std::endl; } @@ -457,8 +461,10 @@ void Mesh::read_velocity(H5::H5File fp, std::string groupname, std::string datas hsize_t *dims = new hsize_t[rank]; dataspace.getSimpleExtentDims(dims); +#if VERBOSE for (int i = 0; i < rank; i ++) std::cout << "[~~~>] Dimensions in " << i << " of velocity in x: " << dims[i] << std::endl; +#endif double *data = new double[dims[0]*dims[1]]; dataset.read(data, H5::PredType::IEEE_F64LE); @@ -486,18 +492,22 @@ void Mesh::read_water_depth(H5::H5File fp) hsize_t *dims = new hsize_t[rank]; dataspace.getSimpleExtentDims(dims); +#if VERBOSE for (int i = 0; i < rank; i ++) std::cout << "[~~~>] Dimensions in " << i << " of velocity in x: " << dims[i] << std::endl; +#endif double *data = new double[dims[0]*dims[1]]; dataset.read(data, H5::PredType::IEEE_F64LE); for (int i = 0; i < n_cells_surface; i ++) { surface_cells[i].set_water_depth(data[i]); +#if VERBOSE if (i%(n_cells_surface/5)==0) { printf("[~~~~>] Surface ponded depth in cell[%d] = %e m\n", i, surface_cells[i].get_water_depth()); } +#endif } } @@ -515,18 +525,22 @@ void Mesh::read_elevation(H5::H5File fp) hsize_t *dims = new hsize_t[rank]; dataspace.getSimpleExtentDims(dims); +#if VERBOSE for (int i = 0; i < rank; i ++) std::cout << "[~~~>] Dimensions in " << i << " of velocity in x: " << dims[i] << std::endl; +#endif double *data = new double[dims[0]*dims[1]]; dataset.read(data, H5::PredType::IEEE_F64LE); - + for (int i = 0; i < n_cells_surface; i ++) { surface_cells[i].set_coordinate(2, data[i]); +#if VERBOSE if (i%(n_cells_surface/5)==0) { printf("[~~~~>] Surface elevation in cell[%d] = %e m\n", i, surface_cells[i].get_coordinate(2)); } +#endif } } |