forked from sandialabs/omega_h
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from Angelyr/ac/describe-mesh
Describe Mesh
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include <Omega_h_element.hpp> | ||
#include <Omega_h_file.hpp> | ||
|
||
|
||
int main(int argc, char** argv) | ||
{ | ||
auto lib = Omega_h::Library(&argc, &argv); | ||
Omega_h::Mesh mesh = Omega_h::read_mesh_file(argv[1], lib.world()); | ||
std::ostringstream oss; | ||
|
||
#ifdef OMEGA_H_USE_MPI | ||
int comm_rank; | ||
MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank); | ||
oss << "\nComm Rank: " << comm_rank << "\n"; | ||
#endif | ||
|
||
oss << "\nMesh Entity Count by Dimension: (Dim, Entities Count)\n"; | ||
for(int dim=0; dim < mesh.dim(); dim++) | ||
oss << "(" << dim << ", " << mesh.nents(dim) << ")\n"; | ||
|
||
oss << "\nImbalance by Dimension: (Dim, Imbalance)\n"; | ||
for(int dim=0; dim < mesh.dim(); dim++) | ||
oss << "(" << dim << ", " << mesh.imbalance(dim) << ")\n"; | ||
|
||
oss << "\nMesh Family: " << Omega_h::topological_singular_name(mesh.family(), mesh.dim()-1) << "\n"; | ||
|
||
oss << "\nTags by Dimension: (Dim, Tag, Size per Entity)\n"; | ||
for (int dim=0; dim < mesh.dim(); dim++) | ||
for (int tag=0; tag < mesh.ntags(dim); tag++) { | ||
auto tagbase = mesh.get_tag(dim, tag); | ||
int size; | ||
if (tagbase->type() == OMEGA_H_I8) | ||
size = mesh.get_tag<Omega_h::I8>(dim, tagbase->name())->array().size(); | ||
if (tagbase->type() == OMEGA_H_I32) | ||
size = mesh.get_tag<Omega_h::I32>(dim, tagbase->name())->array().size(); | ||
if (tagbase->type() == OMEGA_H_I64) | ||
size = mesh.get_tag<Omega_h::I64>(dim, tagbase->name())->array().size(); | ||
if (tagbase->type() == OMEGA_H_F64) | ||
size = mesh.get_tag<Omega_h::Real>(dim, tagbase->name())->array().size(); | ||
|
||
size /= mesh.nents(dim); | ||
oss << "(" << dim << ", " << tagbase->name().c_str() << ", " << size << ")\n"; | ||
} | ||
|
||
oss << "\n--------------------------------------------------------\n"; | ||
std::cout << oss.str(); | ||
} |