30 #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING 32 #include "base_data_package.h" 43 #include <boost/filesystem.hpp> 44 namespace fs = boost::filesystem;
46 #include <experimental/filesystem> 47 namespace fs = std::experimental::filesystem;
75 std::string input_folder_;
76 std::string output_folder_;
77 std::string restart_folder_;
78 std::string reload_folder_;
79 std::string restart_step_;
94 void writeAQuantityHeader(std::ofstream &out_file,
const Real &quantity,
const std::string &quantity_name);
95 void writeAQuantityHeader(std::ofstream &out_file,
const Vecd &quantity,
const std::string &quantity_name);
96 void writeAQuantity(std::ofstream &out_file,
const Real &quantity);
97 void writeAQuantity(std::ofstream &out_file,
const Vecd &quantity);
111 std::string convertPhysicalTimeToString(Real physical_time);
115 : in_output_(in_output), body_(&body), bodies_({&body}){};
117 : in_output_(in_output), body_(bodies[0]), bodies_(bodies){};
144 virtual void writeWithFileName(
const std::string &sequence) = 0;
151 template <
class MobilizedBodyType>
156 SimTK::RungeKuttaMersonIntegrator &integ_;
157 MobilizedBodyType &mobody_;
161 : in_output_(in_output), integ_(integ), mobody_(mobody){};
169 template <
class MobilizedBodyType>
177 virtual void writeToFile(
size_t iteration_step) = 0;
184 template <
class MobilizedBodyType>
194 virtual void readFromFile(
size_t iteration_step) = 0;
212 virtual void writeWithFileName(
const std::string &sequence)
override;
235 virtual void writeWithFileName(
const std::string &sequence)
override;
236 virtual void writeVtu(std::ostream &stream,
SPHBody *body)
const;
257 virtual void writeWithFileName(
const std::string &sequence)
override;
270 StdVec<VelocityBoundCheck> check_bodies_;
271 virtual void writeWithFileName(
const std::string &sequence)
override;
286 std::string filefullpath_;
288 virtual void writeWithFileName(
const std::string &sequence)
override;
299 template <
typename VariableType>
307 std::string body_name_;
308 const std::string quantity_name_;
309 std::string filefullpath_output_;
318 observer_dynamics::ObservingAQuantity<
VariableType>(contact_relation, quantity_name),
319 observer_(contact_relation.sph_body_), plt_engine_(),
320 base_particles_(observer_->base_particles_), body_name_(contact_relation.sph_body_->getBodyName()),
321 quantity_name_(quantity_name)
324 filefullpath_output_ = in_output_.output_folder_ +
"/" + body_name_ +
"_" + quantity_name +
"_" + in_output_.restart_step_ +
".dat";
325 std::ofstream out_file(filefullpath_output_.c_str(), std::ios::app);
326 out_file <<
"run_time" 328 for (
size_t i = 0; i != base_particles_->total_real_particles_; ++i)
330 std::string quantity_name_i = quantity_name +
"[" + std::to_string(i) +
"]";
331 plt_engine_.writeAQuantityHeader(out_file, (*this->interpolated_quantities_)[i], quantity_name_i);
338 virtual void writeWithFileName(
const std::string &sequence)
override 340 this->parallel_exec();
341 std::ofstream out_file(filefullpath_output_.c_str(), std::ios::app);
343 for (
size_t i = 0; i != base_particles_->total_real_particles_; ++i)
345 plt_engine_.writeAQuantity(out_file, (*this->interpolated_quantities_)[i]);
356 template <
class ReduceMethodType>
362 ReduceMethodType reduce_method_;
363 std::string body_name_;
364 const std::string quantity_name_;
365 std::string filefullpath_output_;
369 using VariableType = decltype(reduce_method_.InitialReference());
370 VariableType type_indicator_;
373 template <
typename... ConstructorArgs>
375 : in_output_(in_output), plt_engine_(), reduce_method_(
std::forward<ConstructorArgs>(args)...),
376 body_name_(reduce_method_.getSPHBody()->getBodyName()),
377 quantity_name_(reduce_method_.QuantityName())
380 filefullpath_output_ = in_output_.output_folder_ +
"/" + body_name_ +
"_" + quantity_name_ +
"_" + in_output_.restart_step_ +
".dat";
381 std::ofstream out_file(filefullpath_output_.c_str(), std::ios::app);
382 out_file <<
"\"run_time\"" 384 plt_engine_.writeAQuantityHeader(out_file, reduce_method_.InitialReference(), quantity_name_);
390 virtual void writeToFile(
size_t iteration_step = 0)
392 std::ofstream out_file(filefullpath_output_.c_str(), std::ios::app);
394 plt_engine_.writeAQuantity(out_file, reduce_method_.parallel_exec());
414 virtual void writeToFile(
size_t iteration_step = 0);
415 virtual void readFromFile(
size_t iteration_step = 0);
425 std::string overall_file_path_;
428 Real readRestartTime(
size_t restart_step);
434 virtual void writeToFile(
size_t iteration_step = 0);
435 virtual void readFromFile(
size_t iteration_step = 0);
436 virtual Real readRestartFiles(
size_t restart_step)
438 readFromFile(restart_step);
439 return readRestartTime(restart_step);
450 std::string filefullpath_;
455 virtual void writeToFile(
size_t iteration_step = 0)
override;
467 std::string file_path_;
474 virtual void writeToFile(
size_t iteration_step = 0);
475 virtual void readFromFile(
size_t iteration_step = 0);
Particles with essential (geometric and kinematic) data. There are three types of particles, all par...
Definition: base_particles.h:81
Write the restart file in XML format.
Definition: in_output.h:422
The base relation between a SPH body and its contact SPH bodies.
Definition: base_body_relation.h:136
For write and read material property.
Definition: in_output.h:462
Observing a variable from contact bodies.
Definition: observer_dynamics.h:119
Base of all materials.
Definition: base_material.h:52
base class for write SimBody states.
Definition: in_output.h:170
void writeToFile()
Definition: in_output.h:135
Write total force acting a solid body.
Definition: in_output.h:447
The base class which defines Tecplot file related operation.
Definition: in_output.h:88
XML class for xml input and output, this is GUI of simbody xml parser.
A wrapper to provide an ownership for a new derived object which previous often generated by new a ra...
Definition: ownership.h:90
Abstract base class for the field data saved on a mesh.
Definition: base_mesh.h:128
Write files for bodies the output file is VTK XML format can visualized by ParaView the data type vtk...
Definition: in_output.h:202
Write files for bodies the output file is dat format can visualized by TecPlot.
Definition: in_output.h:247
base class for write and read body states.
Definition: in_output.h:104
Write strings for bodies the output is map of strings with VTK XML format can visualized by ParaView ...
Definition: in_output.h:221
output body sates if particle velocity is out of a bound
Definition: in_output.h:265
std::map< std::string, std::string > VtuStringData
Definition: in_output.h:50
static Real physical_time_
Definition: base_particle_dynamics.h:132
This is the base classes for introducing the parameterization of a class or method.
ObservedQuantityRecording(const std::string &quantity_name, InOutput &in_output, BaseBodyRelationContact &contact_relation)
Definition: in_output.h:315
StdVec< SPHBody * > SPHBodyVector
Definition: sph_data_containers.h:30
base class for write and read SimBody states.
Definition: in_output.h:152
Set up of basic data structure.
base class for write body states.
Definition: in_output.h:125
write the background mesh data for relax body
Definition: in_output.h:283
SPHBody is a base body with basic data and functions. Its derived class can be a real fluid body...
Definition: base_body.h:61
Definition: parameterization.h:40
The base class which defines folders for output, restart and particle reload folders.
Definition: in_output.h:65
write files for observed quantity
Definition: in_output.h:300
BodyReducedQuantityRecording(InOutput &in_output, ConstructorArgs &&...args)
Definition: in_output.h:374
The SPH system managing objects in the system level.
Definition: sph_system.h:46
write reduced quantity of a body
Definition: in_output.h:357
Write the reload particles file in XML format.
Definition: in_output.h:404
Definition: solid_body_supplementary.cpp:9
base class for read SimBody states.
Definition: in_output.h:185