From f0099e7c8b2b121646bd55d236337c3c58f6bfe5 Mon Sep 17 00:00:00 2001 From: "E. Seegyoung Seol" Date: Wed, 15 Jan 2025 23:47:43 -0500 Subject: [PATCH] fixing ctest error with adios2_io --- src/CMakeLists.txt | 1 + src/Omega_h_adios2.cpp | 16 ++++++++-------- src/Omega_h_adios2.hpp | 4 ++-- src/adios2_io.cpp | 33 +++++++++++++-------------------- 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e0afc987..98245d8f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -657,6 +657,7 @@ if(BUILD_TESTING) osh_add_exe(adios2_io) test_basefunc(adios2_io 1 ./adios2_io ${CMAKE_SOURCE_DIR}/meshes/unitbox_cutTriCube_1k.osh + ${CMAKE_SOURCE_DIR}/meshes/plate_6elem.osh output.bp) endif() endif() diff --git a/src/Omega_h_adios2.cpp b/src/Omega_h_adios2.cpp index 56514a8b..92329692 100644 --- a/src/Omega_h_adios2.cpp +++ b/src/Omega_h_adios2.cpp @@ -13,7 +13,7 @@ namespace Omega_h { long unsigned int comm_size, rank; template -void write_value(adios2::IO &io, adios2::Engine &writer, +static void write_value(adios2::IO &io, adios2::Engine &writer, T val, std::string &name, bool global) { if (global) @@ -35,7 +35,7 @@ void write_value(adios2::IO &io, adios2::Engine &writer, } template -void read_value(adios2::IO &io, adios2::Engine &reader, +static void read_value(adios2::IO &io, adios2::Engine &reader, T *val, std::string &name, bool global) { adios2::Variable bpData = io.InquireVariable(name); @@ -55,7 +55,7 @@ void read_value(adios2::IO &io, adios2::Engine &reader, } template -void write_array(adios2::IO &io, adios2::Engine &writer, Read array, +static void write_array(adios2::IO &io, adios2::Engine &writer, Read array, std::string &name) { // std::cout<<__func__<<" "< array, } template -void read_array(adios2::IO &io, adios2::Engine &reader, +static void read_array(adios2::IO &io, adios2::Engine &reader, Read &array, std::string &name) { // usage: Read array; @@ -333,7 +333,7 @@ void read_tags(adios2::IO &io, adios2::Engine &reader, Mesh* mesh, int d, std::s } } -void write_pbdry(adios2::IO &io, adios2::Engine &writer, Mesh* mesh, int d, std::string pref) +void write_part_boundary(adios2::IO &io, adios2::Engine &writer, Mesh* mesh, int d, std::string pref) { if (mesh->comm()->size() == 1) return; auto owners = mesh->ask_owners(d); @@ -343,7 +343,7 @@ void write_pbdry(adios2::IO &io, adios2::Engine &writer, Mesh* mesh, int d, std: write_array(io, writer, owners.idxs, name); } -void read_pbdry(adios2::IO &io, adios2::Engine &reader, Mesh* mesh, int d, std::string pref) +void read_part_boundary(adios2::IO &io, adios2::Engine &reader, Mesh* mesh, int d, std::string pref) { if (mesh->comm()->size() == 1) return; Remotes owners; @@ -479,7 +479,7 @@ void _write_adios2(adios2::IO &io, adios2::Engine & writer, for (Int d = 0; d <= mesh->dim(); ++d) { write_tags(io, writer, mesh, d, pref); - write_pbdry(io, writer, mesh, d, pref); + write_part_boundary(io, writer, mesh, d, pref); } write_sets(io, writer, mesh, pref); @@ -548,7 +548,7 @@ Mesh read_adios2(filesystem::path const& path, Library* lib, std::string pref) for (Int d = 0; d <= mesh.dim(); ++d) { read_tags(io, reader, &mesh, d, pref); - read_pbdry(io, reader, &mesh, d, pref); + read_part_boundary(io, reader, &mesh, d, pref); } read_sets(io, reader, &mesh, pref); diff --git a/src/Omega_h_adios2.hpp b/src/Omega_h_adios2.hpp index 03c1dabb..b27796b3 100644 --- a/src/Omega_h_adios2.hpp +++ b/src/Omega_h_adios2.hpp @@ -11,11 +11,11 @@ namespace Omega_h { template -void write_value(adios2::IO &, adios2::Engine &writer, +static void write_value(adios2::IO &, adios2::Engine &writer, T val, std::string &name, bool global=false); template -void read_value(adios2::IO &, adios2::Engine &reader, +static void read_value(adios2::IO &, adios2::Engine &reader, T *val, std::string &name, bool global=false); void write_adios2(filesystem::path const& path, diff --git a/src/adios2_io.cpp b/src/adios2_io.cpp index 63f0075e..e0749a46 100644 --- a/src/adios2_io.cpp +++ b/src/adios2_io.cpp @@ -2,9 +2,6 @@ * * .cpp : adios2 low-level API example to write and read arrays and string * - * Created on: Aug 25, 2024 - * Author: Seegyoung Seol seols@rpi.edu - * */ #include #include @@ -29,9 +26,6 @@ #include #endif -using namespace Omega_h; -using namespace std; - // printTagInfo and getNumEq copied from describe.cpp template void printTagInfo(Omega_h::Mesh mesh, std::ostringstream& oss, int dim, int tag, std::string type) { @@ -57,7 +51,7 @@ int getNumEq(Omega_h::Mesh mesh, std::string tagname, int dim, int value) { return Omega_h::get_sum(each_eq_to); } -void print_info(Library* lib, Omega_h::Mesh mesh); +void print_info(Omega_h::Library* lib, Omega_h::Mesh mesh); // to check the content of .bp, run /lore/seols/romulus-install/bin/bpls // ex. ./bpls mesh.bp @@ -89,19 +83,18 @@ int main(int argc, char *argv[]) Omega_h::Mesh mesh2(&lib); Omega_h::binary::read(inpath2, world, &mesh2); - cout<<"\n--- Mesh loaded from \""< mmap; + std::map mmap; mmap[&mesh1]="m1"; mmap[&mesh2]="m2"; write_adios2(outpath, mmap); @@ -109,27 +102,27 @@ int main(int argc, char *argv[]) Omega_h::Mesh mesh4 = read_adios2(outpath, &lib, std::string("m2")); //Omega_h::vtk::write_parallel("adios2.vtk", &mesh2); - cout<<"\n\n--- Two meshes loaded back from \""<world()->rank(); - ostringstream oss; + std::ostringstream oss; // always print two places to the right of the decimal // for floating point types (i.e., imbalance) oss.precision(2);