1 #ifndef OMEGA_H_FILE_HPP
2 #define OMEGA_H_FILE_HPP
8 #include <Omega_h_config.h>
9 #include <Omega_h_array.hpp>
10 #include <Omega_h_comm.hpp>
11 #include <Omega_h_defines.hpp>
12 #include <Omega_h_filesystem.hpp>
13 #include <Omega_h_mesh.hpp>
14 #include <Omega_h_mixedMesh.hpp>
15 #include <Omega_h_tag.hpp>
17 #ifdef OMEGA_H_USE_SIMMODSUITE
28 OMEGA_H_DLL Mesh read_mesh_file(filesystem::path
const& path, CommPtr comm);
30 bool is_little_endian_cpu();
32 #ifdef OMEGA_H_USE_LIBMESHB
34 void read(Mesh* mesh, std::string
const& filepath);
35 void write(Mesh* mesh, std::string
const& filepath,
int version = 2);
37 Mesh* mesh, std::string
const& filepath, std::string
const& sol_name);
38 void write_sol(Mesh* mesh, std::string
const& filepath,
39 std::string
const& sol_name,
int version = 2);
43 #ifdef OMEGA_H_USE_SIMMODSUITE
51 bool isMixed(filesystem::path
const& mesh, filesystem::path
const& model);
61 Mesh
read(pMesh* m, filesystem::path
const& numbering_fname, CommPtr comm, pMeshDataId* transformedCoordId = NULL);
69 Mesh
read(filesystem::path
const& mesh, filesystem::path
const& model,
80 Mesh
read(filesystem::path
const& mesh, filesystem::path
const& model,
81 filesystem::path
const& numbering, CommPtr comm);
89 MixedMesh
readMixed(filesystem::path
const& mesh, filesystem::path
const& model,
91 void matchRead(filesystem::path
const& mesh_fname, filesystem::path
const& model,
92 CommPtr comm, Mesh *mesh, I8 is_in);
96 #ifdef OMEGA_H_USE_SEACASEXODUS
103 int open(filesystem::path
const& path,
bool verbose =
false);
104 void close(
int exodus_file);
105 int get_num_time_steps(
int exodus_file);
146 void read_mesh(
int exodus_file, Mesh* mesh,
bool verbose =
false,
147 int classify_with = NODE_SETS | SIDE_SETS);
168 std::string
const& prefix =
"", std::string
const& postfix =
"",
169 bool verbose =
false,
bool merge_components =
false);
177 std::string
const& prefix =
"", std::string
const& postfix =
"",
178 bool verbose =
false,
bool merge_components =
false);
179 typedef std::vector<std::string> FieldNames;
197 void write(filesystem::path
const& path, Mesh* mesh,
bool verbose =
false,
198 int classify_with = NODE_SETS | SIDE_SETS,
199 FieldNames excludedNodalFields = FieldNames());
225 Mesh
read_sliced(filesystem::path
const& path, CommPtr comm,
226 bool verbose =
false,
int classify_with = NODE_SETS | SIDE_SETS,
227 int time_step = -1,
bool merge_components =
false);
232 Mesh read(std::istream& stream, CommPtr comm);
233 Mesh read(filesystem::path
const& filename, CommPtr comm);
234 void write(std::ostream& stream, Mesh* mesh);
235 void write(filesystem::path
const& filepath, Mesh* mesh);
237 #ifdef OMEGA_H_USE_GMSH
255 void write_parallel(filesystem::path
const& filename, Mesh& mesh);
261 static constexpr
bool do_compress =
true;
262 static constexpr
bool dont_compress =
false;
263 #ifdef OMEGA_H_USE_ZLIB
264 #define OMEGA_H_DEFAULT_COMPRESS true
266 #define OMEGA_H_DEFAULT_COMPRESS false
268 TagSet get_all_vtk_tags(Mesh* mesh, Int cell_dim);
269 TagSet get_all_vtk_tags_mix(Mesh* mesh, Int cell_dim);
270 void write_vtu(std::ostream& stream, Mesh* mesh, Int cell_dim,
271 TagSet
const& tags,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
272 void write_vtu(filesystem::path
const& filename, Mesh* mesh, Int cell_dim,
273 TagSet
const& tags,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
274 void write_vtu(std::string
const& filename, Mesh* mesh, Int cell_dim,
275 bool compress = OMEGA_H_DEFAULT_COMPRESS);
276 void write_vtu(std::string
const& filename, Mesh* mesh,
277 bool compress = OMEGA_H_DEFAULT_COMPRESS);
279 void write_vtu(filesystem::path
const& filename, MixedMesh* mesh, Topo_type max_type,
280 bool compress = OMEGA_H_DEFAULT_COMPRESS);
282 void write_parallel(filesystem::path
const& path, Mesh* mesh, Int cell_dim,
283 TagSet
const& tags,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
284 void write_parallel(std::string
const& path, Mesh* mesh, Int cell_dim,
285 bool compress = OMEGA_H_DEFAULT_COMPRESS);
287 bool compress = OMEGA_H_DEFAULT_COMPRESS);
289 void read_parallel(filesystem::path
const& pvtupath, CommPtr comm, Mesh* mesh);
290 void read_vtu(std::istream& stream, CommPtr comm, Mesh* mesh);
298 std::streampos pvd_pos_;
306 Real restart_time = 0.0,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
308 void write(Real time);
309 void write(Real time, TagSet
const& tags);
310 void write(I64 step, Real time, TagSet
const& tags);
313 std::vector<Writer> writers_;
318 Real restart_time = 0.0,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
319 void write(Real time);
330 bool strict =
false);
336 constexpr I32 latest_version = 11;
338 template <
typename T>
341 template <
typename T>
344 template <
typename T>
345 void write_value(std::ostream& stream, T val,
bool needs_swapping);
346 template <
typename T>
347 void read_value(std::istream& stream, T& val,
bool needs_swapping);
348 template <
typename T>
349 void write_array(std::ostream& stream,
Read<T> array,
bool is_compressed,
350 bool needs_swapping);
351 template <
typename T>
352 void read_array(std::istream& stream,
Read<T>& array,
bool is_compressed,
353 bool needs_swapping);
355 void write(std::ostream& stream, std::string
const& val,
bool needs_swapping);
356 void read(std::istream& stream, std::string& val,
bool needs_swapping);
358 void write(std::ostream& stream,
Mesh* mesh);
359 void read(std::istream& stream,
Mesh* mesh, I32 version);
361 #define INST_DECL(T) \
362 extern template void swap_bytes(T&); \
363 extern template Read<T> swap_bytes(Read<T> array, bool needs_swapping); \
364 extern template void write_value(std::ostream& stream, T val, bool); \
365 extern template void read_value(std::istream& stream, T& val, bool); \
366 extern template void write_array( \
367 std::ostream& stream, Read<T> array, bool, bool); \
368 extern template void read_array( \
369 std::istream& stream, Read<T>& array, bool, bool);
377 extern template void swap_bytes(std::uint64_t&);
381 void write_reals_txt(filesystem::path
const& filename, Reals a, Int ncomps);
382 void write_reals_txt(std::ostream& stream, Reals a, Int ncomps);
383 Reals read_reals_txt(filesystem::path
const& filename, LO n, Int ncomps);
384 Reals read_reals_txt(std::istream& stream, LO n, Int ncomps);
void write_parallel(filesystem::path const &filename, Mesh &mesh)
Definition: Omega_h_gmsh.cpp:812
Mesh read_parallel(filesystem::path filename, CommPtr comm)
Definition: Omega_h_gmsh.cpp:572
Definition: Omega_h_library.hpp:10
Definition: Omega_h_mesh.hpp:35
Definition: Omega_h_array.hpp:89
Definition: Omega_h_filesystem.hpp:22
Definition: Omega_h_file.hpp:312
Definition: Omega_h_file.hpp:292
void read_nodal_fields(int exodus_file, Mesh *mesh, int time_step, std::string const &prefix, std::string const &postfix, bool verbose, bool merge_components)
Read nodal (vertex) fields from an open Exodus file into a mesh.
Definition: Omega_h_exodus.cpp:369
void read_element_fields(int exodus_file, Mesh *mesh, int time_step, std::string const &prefix, std::string const &postfix, bool verbose, bool merge_components)
Read element fields from an open Exodus file into a mesh.
Definition: Omega_h_exodus.cpp:376
void read_mesh(int file, Mesh *mesh, bool verbose, int classify_with)
Read an Exodus II file into an Omega_h::Mesh and assign geometric classification.
Definition: Omega_h_exodus.cpp:383
Mesh read_sliced(filesystem::path const &, CommPtr, bool, int, int, bool)
Collectively read an Exodus II file into a distributed Omega_h::Mesh.
Definition: Omega_h_exodus.cpp:727
void write(filesystem::path const &path, Mesh *mesh, bool verbose, int classify_with, FieldNames excludedNodalFields)
Write an Omega_h::Mesh to an Exodus II file.
Definition: Omega_h_exodus.cpp:783
Mesh read(pMesh *m, filesystem::path const &numbering_fname, CommPtr comm, pMeshDataId *transformedCoordId=NULL)
Definition: Omega_h_meshsim.cpp:727
bool isMixed(filesystem::path const &mesh, filesystem::path const &model)
Definition: Omega_h_meshsim.cpp:751
MixedMesh readMixed(filesystem::path const &mesh, filesystem::path const &model, CommPtr comm)
Definition: Omega_h_meshsim.cpp:773
Definition: amr_mpi_test.cpp:6