Skip to content

Commit

Permalink
Merge pull request #82 from SCOREC/cws/meshRefactor
Browse files Browse the repository at this point in the history
create a class for mixed mesh support
  • Loading branch information
cwsmith authored Feb 15, 2024
2 parents 8235499 + 6820949 commit 86243ef
Show file tree
Hide file tree
Showing 13 changed files with 1,155 additions and 1,005 deletions.
Binary file modified meshes/d3d/d3d-coreMesh-gold.osh/0.osh
Binary file not shown.
Binary file modified meshes/d3d/d3d-coreMesh-numbered-gold.osh/0.osh
Binary file not shown.
7 changes: 2 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ set(Omega_h_SOURCES
Omega_h_math_lang.cpp
Omega_h_matrix.cpp
Omega_h_mesh.cpp
Omega_h_mixedMesh.cpp
Omega_h_rcFields.cpp
Omega_h_metric.cpp
Omega_h_metric_input.cpp
Expand Down Expand Up @@ -413,11 +414,6 @@ function(test_func_impl TEST_NAME NUM_PROCS)
${CMAKE_SOURCE_DIR}/meshes)

osh_add_exe(periodic_test)
set(TEST_EXES ${TEST_EXES} periodic_test)
test_func(periodic_test 2 ./periodic_test
${CMAKE_SOURCE_DIR}/meshes/wedge_matchZ_12elem.sms
${CMAKE_SOURCE_DIR}/meshes/wedge_match.smd
${CMAKE_SOURCE_DIR}/meshes/wedge_matchZ_12elem_sync_2.osh 2)
endif()

test_basefunc(run_arrayops 1 ./arrayops_test)
Expand Down Expand Up @@ -636,6 +632,7 @@ set(Omega_h_HEADERS
Omega_h_math_lang.hpp
Omega_h_matrix.hpp
Omega_h_mesh.hpp
Omega_h_mixedMesh.hpp
Omega_h_metric.hpp
Omega_h_mpi.h
Omega_h_owners.hpp
Expand Down
28 changes: 0 additions & 28 deletions src/Omega_h_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,32 +190,4 @@ void classify_equal_order(
mesh->add_tag<ClassId>(ent_dim, "class_id", 1, class_id);
}

/* TODO this function is included as work in progress and is not tested */
void classify_equal_order(
Mesh* mesh, Topo_type ent_type, LOs eqv2v, Read<ClassId> eq_class_ids) {
LOs eq2e;
if (ent_type == Topo_type::vertex) {
eq2e = eqv2v;
}
else {
Write<LO> eq2e_w;
Write<I8> codes;
auto ev2v = mesh->ask_verts_of(ent_type);
auto v2e = mesh->ask_up(Topo_type::vertex, ent_type);
find_matches(ent_type, eqv2v, ev2v, v2e, &eq2e_w, &codes);
eq2e = eq2e_w;
}

auto ent_dim = mesh->ent_dim(ent_type);

auto neq = eqv2v.size() / (ent_dim + 1);
auto eq_class_dim = Read<I8>(neq, I8(ent_dim));
auto class_dim =
map_onto(eq_class_dim, eq2e, mesh->nents(ent_type), I8(mesh->dim()), 1);
auto class_id = map_onto(eq_class_ids, eq2e, mesh->nents(ent_type), -1, 1);
mesh->add_tag<I8>(ent_type, "class_dim", 1, class_dim);
mesh->add_tag<ClassId>(ent_type, "class_id", 1, class_id);
}
/* */

} // end namespace Omega_h
22 changes: 20 additions & 2 deletions src/Omega_h_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <Omega_h_defines.hpp>
#include <Omega_h_filesystem.hpp>
#include <Omega_h_mesh.hpp>
#include <Omega_h_mixedMesh.hpp>
#include <Omega_h_tag.hpp>

namespace Omega_h {
Expand All @@ -31,6 +32,13 @@ void write_sol(Mesh* mesh, std::string const& filepath,

#ifdef OMEGA_H_USE_SIMMODSUITE
namespace meshsim {
/**
* Return if the mesh is mixed or mono topology
* @param[in] mesh path to Simmetrix .sms mesh file
* @param[in] model path to Simmetrix GeomSim .smd model file
*/
bool isMixed(filesystem::path const& mesh, filesystem::path const& model);

/**
* Convert a serial Simmetrix sms mesh classified on the specified model to an
* Omega_h mesh instance.
Expand All @@ -41,7 +49,8 @@ namespace meshsim {
Mesh read(filesystem::path const& mesh, filesystem::path const& model,
CommPtr comm);
/**
* Convert a serial Simmetrix sms mesh classified on the specified model to an
* Convert a mono topology (i.e., all tets, all triangles, all hex, etc.)
* serial Simmetrix sms mesh classified on the specified model to an
* Omega_h mesh instance and attach a Simmetrix MeshNex vertex numbering.
* @param[in] mesh path to Simmetrix .sms mesh file
* @param[in] model path to Simmetrix GeomSim .smd model file
Expand All @@ -50,6 +59,15 @@ Mesh read(filesystem::path const& mesh, filesystem::path const& model,
*/
Mesh read(filesystem::path const& mesh, filesystem::path const& model,
filesystem::path const& numbering, CommPtr comm);
/**
* Convert a mixed topology (i.e., tet + wedge) serial Simmetrix sms mesh
* classified on the specified model to an Omega_h mesh instance.
* @param[in] mesh path to Simmetrix .sms mesh file
* @param[in] model path to Simmetrix GeomSim .smd model file
* @param[in] comm path to Omega_h communicator instance
*/
MixedMesh readMixed(filesystem::path const& mesh, filesystem::path const& model,
CommPtr comm);
void matchRead(filesystem::path const& mesh_fname, filesystem::path const& model,
CommPtr comm, Mesh *mesh, I8 is_in);
} // namespace meshsim
Expand Down Expand Up @@ -125,7 +143,7 @@ void write_vtu(std::string const& filename, Mesh* mesh, Int cell_dim,
void write_vtu(std::string const& filename, Mesh* mesh,
bool compress = OMEGA_H_DEFAULT_COMPRESS);

void write_vtu(filesystem::path const& filename, Mesh* mesh, Topo_type max_type,
void write_vtu(filesystem::path const& filename, MixedMesh* mesh, Topo_type max_type,
bool compress = OMEGA_H_DEFAULT_COMPRESS);

void write_parallel(filesystem::path const& path, Mesh* mesh, Int cell_dim,
Expand Down
Loading

0 comments on commit 86243ef

Please sign in to comment.