Skip to content

Commit 8121d8a

Browse files
fix(core): Recovered the VTP support
1 parent 95b6e05 commit 8121d8a

7 files changed

Lines changed: 627 additions & 461 deletions

File tree

source/Body.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class DECLDIR Body final
438438
*/
439439
uint64_t* Deserialize(const uint64_t* data);
440440

441-
/** @brief Save the body on a VTK (.vtu) file
441+
/** @brief Save the body on a VTK (.vtp) file
442442
* @param filename The output file name
443443
* @throws output_file_error If the file cannot be saved
444444
*/
@@ -449,10 +449,10 @@ class DECLDIR Body final
449449
* This function is useful for writing multiblock .vtm files
450450
* @return The VTK .vtu writer
451451
*/
452-
const leanvtk::VTUWriter& getVTK() const { return vtk; }
452+
const leanvtk::VTPWriter* getVTK() const { return &vtk; }
453453
private:
454454
/// VTK .vtu file writer
455-
leanvtk::VTUWriter vtk;
455+
leanvtk::VTPWriter vtk;
456456

457457
/** @brief Helper function to setup an initial body representation
458458
*/

source/Line.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ class DECLDIR Line final
10681068
*/
10691069
uint64_t* Deserialize(const uint64_t* data);
10701070

1071-
/** @brief Save the line on a VTK (.vtu) file
1071+
/** @brief Save the line on a VTK (.vtp) file
10721072
* @param filename The output file name
10731073
* @throws output_file_error If If the file cannot be saved
10741074
*/
@@ -1079,10 +1079,10 @@ class DECLDIR Line final
10791079
* This function is useful for writing multiblock .vtm files
10801080
* @return The VTK .vtu writer
10811081
*/
1082-
const leanvtk::VTUWriter& getVTK() const { return vtk; }
1082+
const leanvtk::VTPWriter* getVTK() const { return &vtk; }
10831083
private:
10841084
/// VTK .vtu file writer
1085-
leanvtk::VTUWriter vtk;
1085+
leanvtk::VTPWriter vtk;
10861086
};
10871087

10881088
} // ::moordyn

source/MoorDyn2.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -877,25 +877,25 @@ MoorDyn::saveVTK(const char* filename) const
877877
}
878878
// Time to write the subentities
879879
prefix = prefix + "/" + stem + "_";
880-
std::vector<leanvtk::VTUWriter> vtus;
880+
std::vector<leanvtk::VTKWriter*> vtks;
881881
for (auto body : BodyList) {
882-
body->saveVTK((prefix + std::to_string(vtus.size()) + ".vtu").c_str());
883-
vtus.push_back(body->getVTK());
882+
body->saveVTK((prefix + std::to_string(vtks.size()) + ".vtp").c_str());
883+
vtks.push_back((leanvtk::VTKWriter*)body->getVTK());
884884
}
885885
for (auto point : PointList) {
886-
point->saveVTK((prefix + std::to_string(vtus.size()) + ".vtu").c_str());
887-
vtus.push_back(point->getVTK());
886+
point->saveVTK((prefix + std::to_string(vtks.size()) + ".vtp").c_str());
887+
vtks.push_back((leanvtk::VTKWriter*)point->getVTK());
888888
}
889889
for (auto rod : RodList) {
890-
rod->saveVTK((prefix + std::to_string(vtus.size()) + ".vtu").c_str());
891-
vtus.push_back(rod->getVTK());
890+
rod->saveVTK((prefix + std::to_string(vtks.size()) + ".vtp").c_str());
891+
vtks.push_back((leanvtk::VTKWriter*)rod->getVTK());
892892
}
893893
for (auto line : LineList) {
894-
line->saveVTK((prefix + std::to_string(vtus.size()) + ".vtu").c_str());
895-
vtus.push_back(line->getVTK());
894+
line->saveVTK((prefix + std::to_string(vtks.size()) + ".vtp").c_str());
895+
vtks.push_back((leanvtk::VTKWriter*)line->getVTK());
896896
}
897897

898-
if (!write_vtm(filepath.u8string(), vtus)) {
898+
if (!write_vtm(filepath.u8string(), vtks)) {
899899
throw moordyn::output_file_error((
900900
std::string("Failure saving the system VTM file '") +
901901
filepath.u8string() +

source/Point.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ class DECLDIR Point final
439439
*/
440440
uint64_t* Deserialize(const uint64_t* data);
441441

442-
/** @brief Save the point on a VTK (.vtu) file
442+
/** @brief Save the point on a VTK (.vtp) file
443443
* @param filename The output file name
444444
* @throws output_file_error If the file cannot be saved
445445
*/
@@ -450,11 +450,11 @@ class DECLDIR Point final
450450
* This function is useful for writing multiblock .vtm files
451451
* @return The VTK .vtu writer
452452
*/
453-
const leanvtk::VTUWriter& getVTK() const { return vtk; }
453+
const leanvtk::VTPWriter* getVTK() const { return &vtk; }
454454

455455
private:
456456
/// VTK .vtu file writer
457-
leanvtk::VTUWriter vtk;
457+
leanvtk::VTPWriter vtk;
458458

459459
/** @brief Calculate the centripetal force on a body
460460
* @param r The body position

source/Rod.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ class DECLDIR Rod final
608608
*/
609609
uint64_t* Deserialize(const uint64_t* data);
610610

611-
/** @brief Save the rod on a VTK (.vtu) file
611+
/** @brief Save the rod on a VTK (.vtp) file
612612
* @param filename The output file name
613613
* @throws output_file_error If the file cannot be saved
614614
*/
@@ -617,13 +617,13 @@ class DECLDIR Rod final
617617
/** @brief Get the VTK writer
618618
*
619619
* This function is useful for writing multiblock .vtm files
620-
* @return The VTK .vtu writer
620+
* @return The VTK .vtp writer
621621
*/
622-
const leanvtk::VTUWriter& getVTK() const { return vtk; }
622+
const leanvtk::VTPWriter* getVTK() const { return &vtk; }
623623

624624
private:
625625
/// VTK .vtu file writer
626-
leanvtk::VTUWriter vtk;
626+
leanvtk::VTPWriter vtk;
627627

628628
/** @brief Calculate the centripetal force on a body
629629
* @param r The body position

0 commit comments

Comments
 (0)