-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathio_mesh_ascii.h
More file actions
149 lines (121 loc) · 5.43 KB
/
io_mesh_ascii.h
File metadata and controls
149 lines (121 loc) · 5.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#ifndef MPM_IO_MESH_ASCII_H_
#define MPM_IO_MESH_ASCII_H_
#include <vector>
#include "Eigen/Dense"
#include "io_mesh.h"
//! MPM namespace
namespace mpm {
//! IOMeshAscii class
//! \brief Derived class that returns mesh and particles locataions from ascii
//! file \tparam Tdim Dimension
template <unsigned Tdim>
class IOMeshAscii : public IOMesh<Tdim> {
public:
//! Define a vector of size dimension
using VectorDim = Eigen::Matrix<double, Tdim, 1>;
//! Constructor
IOMeshAscii() : mpm::IOMesh<Tdim>() {
//! Logger
console_ = spdlog::get("IOMeshAscii");
}
//! Destructor
~IOMeshAscii() override = default;
//! Read mesh nodes file
//! \param[in] mesh file name with nodes and cells
//! \retval coordinates Vector of nodal coordinates
std::vector<VectorDim> read_mesh_nodes(const std::string& mesh) override;
//! Read mesh cells file
//! \param[in] mesh file name with nodes and cells
//! \retval cells Vector of nodal indices of cells
std::vector<std::vector<mpm::Index>> read_mesh_cells(
const std::string& mesh) override;
//! Read particles file
//! \param[in] particles_files file name with particle coordinates
//! \retval coordinates Vector of particle coordinates
std::vector<VectorDim> read_particles(
const std::string& particles_file) override;
//! Read particle stresses
//! \param[in] particles_stresses file name with particle stresses
//! \retval stresses Vector of particle stresses
std::vector<Eigen::Matrix<double, 6, 1>> read_particles_stresses(
const std::string& particles_stresses) override;
//! Read scalar properties for particles or nodes
//! \param[in] scalar_file file name with particle or node scalar properties
//! \retval Vector of scalar properties for particles or nodes
std::vector<std::tuple<mpm::Index, double>> read_scalar_properties(
const std::string& scalar_file) override;
//! Read pressure constraints file
//! \param[in] pressure_constraints_files file name with pressure
//! constraints
std::vector<std::tuple<mpm::Index, double>> read_pressure_constraints(
const std::string& pressure_constraints_file) override;
//! Read nodal euler angles file
//! \param[in] nodal_euler_angles_file file name with nodal id and respective
//! euler angles
std::map<mpm::Index, Eigen::Matrix<double, Tdim, 1>> read_euler_angles(
const std::string& nodal_euler_angles_file) override;
//! Read volume file
//! \param[in] volume_files file name with particle volumes
std::vector<std::tuple<mpm::Index, double>> read_particles_volumes(
const std::string& volume_file) override;
//! Read particles cells file
//! \param[in] particles_cells_file file name with particle cell ids
std::vector<std::array<mpm::Index, 2>> read_particles_cells(
const std::string& particles_cells_file) override;
//! Write particles cells file
//! \param[in] particle_cells List of particles and cells
//! \param[in] particles_cells_file file name with particle cell ids
void write_particles_cells(
const std::string& particles_cells_file,
const std::vector<std::array<mpm::Index, 2>>& particles_cells) override;
//! Read velocity constraints file
//! \param[in] velocity_constraints_file file name with constraints
std::vector<std::tuple<mpm::Index, unsigned, double>>
read_velocity_constraints(
const std::string& velocity_constraints_file) override;
//! Read acceleration constraints file
//! \param[in] acceleration_constraints_file file name with constraints
std::vector<std::tuple<mpm::Index, unsigned, double>>
read_acceleration_constraints(
const std::string& acceleration_constraints_file) override;
//! Read friction constraints file
//! \param[in] friction_constraints_file file name with friction values
std::vector<std::tuple<mpm::Index, unsigned, int, double>>
read_friction_constraints(
const std::string& friction_constraints_file) override;
//! Read adhesion constraints file
//! \param[in] adhesion_constraints_file file name with adhesion values
std::vector<std::tuple<mpm::Index, unsigned, int, double, double, int>>
read_adhesion_constraints(
const std::string& adhesion_constraints_file) override;
//! Read levelset file
//! \param[in] levelset_input_file file name with levelset values
std::vector<std::tuple<mpm::Index, double, double, double, double>>
read_levelset_input(const std::string& levelset_input_file) override;
//! Read traction file
//! \param[in] forces_file file name with nodal concentrated force
std::vector<std::tuple<mpm::Index, unsigned, double>> read_forces(
const std::string& forces_file) override;
//! Read math function file
//! \param[in] function_file file name with linear math function entries
std::array<std::vector<double>, 2> read_math_functions(
const std::string& math_file) override;
/**
* \defgroup Implicit Functions dealing with implicit MPM
*/
/**@{*/
//! Read displacement constraints file for implicit solver
//! \ingroup Implicit
//! \param[in] displacement_constraints_files file name with displacement
//! constraints
std::vector<std::tuple<mpm::Index, unsigned, double>>
read_displacement_constraints(
const std::string& displacement_constraints_file) override;
/**@}*/
private:
//! Logger
std::shared_ptr<spdlog::logger> console_;
}; // ReadAscii class
} // namespace mpm
#include "io_mesh_ascii.tcc"
#endif // MPM_IO_MESH_ASCII_H_