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);
148 void read_nodal_fields(
int exodus_file, Mesh* mesh,
int time_step,
149 std::string
const& prefix =
"", std::string
const& postfix =
"",
150 bool verbose =
false);
151 void read_element_fields(
int exodus_file, Mesh* mesh,
int time_step,
152 std::string
const& prefix =
"", std::string
const& postfix =
"",
153 bool verbose =
false);
154 typedef std::vector<std::string> FieldNames;
155 void write(filesystem::path
const& path, Mesh* mesh,
bool verbose =
false,
156 int classify_with = NODE_SETS | SIDE_SETS,
157 FieldNames excludedNodalFields = FieldNames());
158 Mesh read_sliced(filesystem::path
const& path, CommPtr comm,
159 bool verbose =
false,
int classify_with = NODE_SETS | SIDE_SETS,
165 Mesh read(std::istream& stream, CommPtr comm);
166 Mesh read(filesystem::path
const& filename, CommPtr comm);
167 void write(std::ostream& stream, Mesh* mesh);
168 void write(filesystem::path
const& filepath, Mesh* mesh);
170 #ifdef OMEGA_H_USE_GMSH
188 void write_parallel(filesystem::path
const& filename, Mesh& mesh);
194 static constexpr
bool do_compress =
true;
195 static constexpr
bool dont_compress =
false;
196 #ifdef OMEGA_H_USE_ZLIB
197 #define OMEGA_H_DEFAULT_COMPRESS true
199 #define OMEGA_H_DEFAULT_COMPRESS false
201 TagSet get_all_vtk_tags(Mesh* mesh, Int cell_dim);
202 TagSet get_all_vtk_tags_mix(Mesh* mesh, Int cell_dim);
203 void write_vtu(std::ostream& stream, Mesh* mesh, Int cell_dim,
204 TagSet
const& tags,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
205 void write_vtu(filesystem::path
const& filename, Mesh* mesh, Int cell_dim,
206 TagSet
const& tags,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
207 void write_vtu(std::string
const& filename, Mesh* mesh, Int cell_dim,
208 bool compress = OMEGA_H_DEFAULT_COMPRESS);
209 void write_vtu(std::string
const& filename, Mesh* mesh,
210 bool compress = OMEGA_H_DEFAULT_COMPRESS);
212 void write_vtu(filesystem::path
const& filename, MixedMesh* mesh, Topo_type max_type,
213 bool compress = OMEGA_H_DEFAULT_COMPRESS);
215 void write_parallel(filesystem::path
const& path, Mesh* mesh, Int cell_dim,
216 TagSet
const& tags,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
217 void write_parallel(std::string
const& path, Mesh* mesh, Int cell_dim,
218 bool compress = OMEGA_H_DEFAULT_COMPRESS);
220 bool compress = OMEGA_H_DEFAULT_COMPRESS);
222 void read_parallel(filesystem::path
const& pvtupath, CommPtr comm, Mesh* mesh);
223 void read_vtu(std::istream& stream, CommPtr comm, Mesh* mesh);
231 std::streampos pvd_pos_;
239 Real restart_time = 0.0,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
241 void write(Real time);
242 void write(Real time, TagSet
const& tags);
243 void write(I64 step, Real time, TagSet
const& tags);
246 std::vector<Writer> writers_;
251 Real restart_time = 0.0,
bool compress = OMEGA_H_DEFAULT_COMPRESS);
252 void write(Real time);
263 bool strict =
false);
269 constexpr I32 latest_version = 11;
271 template <
typename T>
274 template <
typename T>
277 template <
typename T>
278 void write_value(std::ostream& stream, T val,
bool needs_swapping);
279 template <
typename T>
280 void read_value(std::istream& stream, T& val,
bool needs_swapping);
281 template <
typename T>
282 void write_array(std::ostream& stream,
Read<T> array,
bool is_compressed,
283 bool needs_swapping);
284 template <
typename T>
285 void read_array(std::istream& stream,
Read<T>& array,
bool is_compressed,
286 bool needs_swapping);
288 void write(std::ostream& stream, std::string
const& val,
bool needs_swapping);
289 void read(std::istream& stream, std::string& val,
bool needs_swapping);
291 void write(std::ostream& stream,
Mesh* mesh);
292 void read(std::istream& stream,
Mesh* mesh, I32 version);
294 #define INST_DECL(T) \
295 extern template void swap_bytes(T&); \
296 extern template Read<T> swap_bytes(Read<T> array, bool needs_swapping); \
297 extern template void write_value(std::ostream& stream, T val, bool); \
298 extern template void read_value(std::istream& stream, T& val, bool); \
299 extern template void write_array( \
300 std::ostream& stream, Read<T> array, bool, bool); \
301 extern template void read_array( \
302 std::istream& stream, Read<T>& array, bool, bool);
310 extern template void swap_bytes(std::uint64_t&);
314 void write_reals_txt(filesystem::path
const& filename, Reals a, Int ncomps);
315 void write_reals_txt(std::ostream& stream, Reals a, Int ncomps);
316 Reals read_reals_txt(filesystem::path
const& filename, LO n, Int ncomps);
317 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:783
Mesh read_parallel(filesystem::path filename, CommPtr comm)
Definition: Omega_h_gmsh.cpp:543
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:245
Definition: Omega_h_file.hpp:225
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:249
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