Skip to content

Commit

Permalink
add more silo blueprint i/o support
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinPrivitera committed Jun 15, 2023
2 parents 0ceaa01 + d06c6c4 commit 1ac3851
Show file tree
Hide file tree
Showing 116 changed files with 7,285 additions and 1,192 deletions.
7 changes: 7 additions & 0 deletions src/cmake/thirdparty/SetupSilo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ if(${SILO_JSON_LIBS})
endif()
set(SILO_INCLUDE_DIRS ${SILO_INCLUDE_DIR} )

#
# Add ZLIB to the SILO_LIBRARIES
#
if(ZLIB_FOUND)
list(APPEND SILO_LIBRARIES ${ZLIB_LIBRARIES})
endif()


include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set SILO_FOUND to TRUE
Expand Down
15 changes: 15 additions & 0 deletions src/libs/blueprint/conduit_blueprint_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7813,6 +7813,21 @@ mesh::flatten(const conduit::Node &mesh,
do_flatten.execute(mesh, output);
}

//-----------------------------------------------------------------------------
void mesh::generate_domain_ids(conduit::Node &domains)
{
int num_domains = (int)domains.number_of_children();

int domain_offset = 0;

for(int i = 0; i < num_domains; ++i)
{
conduit::Node &dom = domains.child(i);
dom["state/domain_id"] = domain_offset + i;
}
}


}
//-----------------------------------------------------------------------------
// -- end conduit::blueprint --
Expand Down
1 change: 1 addition & 0 deletions src/libs/blueprint/conduit_blueprint_mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ void CONDUIT_BLUEPRINT_API flatten(const conduit::Node &mesh,
const conduit::Node &options,
conduit::Node &output);

void CONDUIT_BLUEPRINT_API generate_domain_ids(conduit::Node &domains);

//-----------------------------------------------------------------------------
/// blueprint mesh transform methods (these work on multi domain meshes)
Expand Down
34 changes: 34 additions & 0 deletions src/libs/blueprint/conduit_blueprint_mpi_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2706,6 +2706,40 @@ flatten(const conduit::Node &mesh, const conduit::Node &options,
do_flatten.execute(mesh, output);
}

//-------------------------------------------------------------------------
//
// recalculate domain ids so that we are consistant.
// Assumes that domains are valid
//
void generate_domain_ids(conduit::Node &domains,
MPI_Comm mpi_comm)
{
int num_domains = (int)domains.number_of_children();

int domain_offset = 0;

int comm_size = 1;
int rank = 0;

MPI_Comm_rank(mpi_comm,&rank);
MPI_Comm_size(mpi_comm, &comm_size);
int *domains_per_rank = new int[comm_size];

MPI_Allgather(&num_domains, 1, MPI_INT, domains_per_rank, 1, MPI_INT, mpi_comm);

for(int i = 0; i < rank; ++i)
{
domain_offset += domains_per_rank[i];
}
delete[] domains_per_rank;

for(int i = 0; i < num_domains; ++i)
{
conduit::Node &dom = domains.child(i);
dom["state/domain_id"] = domain_offset + i;
}
}

//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/libs/blueprint/conduit_blueprint_mpi_mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ void CONDUIT_BLUEPRINT_API flatten(const conduit::Node &mesh,
conduit::Node &output,
MPI_Comm comm);

void CONDUIT_BLUEPRINT_API generate_domain_ids(conduit::Node &domains,
MPI_Comm mpi_comm);

//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/libs/conduit/conduit_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
//-----------------------------------------------------------------------------
#define CONDUIT_ASSERT( cond, msg ) \
{ \
if(!cond) \
if(!(cond)) \
{ \
std::ostringstream conduit_oss_assert; \
conduit_oss_assert << msg; \
Expand All @@ -120,7 +120,7 @@
//-----------------------------------------------------------------------------
#define CONDUIT_CHECK( cond, msg ) \
{ \
if(!cond) \
if(!(cond)) \
{ \
std::ostringstream conduit_oss_check; \
conduit_oss_check << msg; \
Expand Down
4 changes: 3 additions & 1 deletion src/libs/relay/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ set(conduit_relay_mpi_io_headers conduit_relay_mpi_io.hpp)
set(conduit_relay_mpi_io_deps conduit
${conduit_blt_mpi_deps}
conduit_relay_mpi
conduit_relay)
conduit_relay
conduit_blueprint
conduit_blueprint_mpi)

#
# Specify relay mpi c headers
Expand Down
19 changes: 0 additions & 19 deletions src/libs/relay/conduit_relay_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,6 @@ save(const Node &node,
#else
CONDUIT_ERROR("conduit_relay lacks Silo support: " <<
"Failed to save conduit node to path " << path);
#endif
}
else if(protocol == "conduit_silo_mesh")
{
#ifdef CONDUIT_RELAY_IO_SILO_ENABLED
silo_mesh_write(node,path);
#else
CONDUIT_ERROR("conduit_relay lacks Silo support: " <<
"Failed to save conduit mesh node to path " << path);
#endif
}
else if( protocol == "adios")
Expand Down Expand Up @@ -534,16 +525,6 @@ save_merged(const Node &node,
#else
CONDUIT_ERROR("conduit_relay lacks Silo support: " <<
"Failed to save conduit node to path " << path);
#endif
}
else if(protocol == "conduit_silo_mesh")
{
#ifdef CONDUIT_RELAY_IO_SILO_ENABLED
/// TODO .. ?
silo_mesh_write(node,path);
#else
CONDUIT_ERROR("conduit_relay lacks Silo support: " <<
"Failed to save conduit mesh node to path " << path);
#endif
}
else if( protocol == "adios")
Expand Down

0 comments on commit 1ac3851

Please sign in to comment.