Skip to content

Commit f46998f

Browse files
committed
- updated Catch2
- fixes for new gcc version
1 parent 3402fed commit f46998f

File tree

7 files changed

+6393
-2807
lines changed

7 files changed

+6393
-2807
lines changed

Changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2.11.6
2+
- updated Catch2
3+
- fixes for new gcc version
4+
15
2.11.5
26
- updated cxxopts
37

Tools/MeshSkinning/main.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ unsigned int getNeighbor(const unsigned int pointSetIndex, const unsigned int in
112112
return neighborhoodSearch->point_set(0).neighbor(pointSetIndex, index, k);
113113
}
114114

115-
std::istream& operator >> (std::istream& istream, Vector3r& r)
116-
{
117-
return istream >> std::skipws >> r[0] >> r[1] >> r[2];
118-
}
119-
120115
std::ostream& operator << (std::ostream& out, const Vector3r& r)
121116
{
122117
out << r[0] << ", " << r[1] << ", " << r[2];
@@ -142,9 +137,9 @@ int main( int argc, char **argv )
142137
("m,mesh", "Mesh file ", cxxopts::value<std::string>())
143138
("scene", "Scene file (all settings are imported from the scene file)", cxxopts::value<std::string>())
144139
("partioPath", "Path of the partio files (when using a scene file). If not set, it is assumed that the files are in the standard output path.", cxxopts::value<std::string>())
145-
("scale", "Scaling of input geometry (e.g. --scale \"2 1 2\")", cxxopts::value<Vector3r>()->default_value("1 1 1"))
146-
("t,translation", "Translation of input geometry (e.g. --translation \"2 1 2\")", cxxopts::value<Vector3r>()->default_value("1 1 1"))
147-
("axis", "Rotation axis of input geometry (e.g. --axis \"1 0 0\")", cxxopts::value<Vector3r>()->default_value("1 0 0"))
140+
("scale", "Scaling of input geometry (e.g. --scale 2,1,2)", cxxopts::value<std::vector<Real>>()->default_value("1,1,1"))
141+
("t,translation", "Translation of input geometry (e.g. --translation 2,1,2)", cxxopts::value<std::vector<Real>>()->default_value("0,0,0"))
142+
("axis", "Rotation axis of input geometry (e.g. --axis 1,0,0)", cxxopts::value<std::vector<Real>>()->default_value("1,0,0"))
148143
("angle", "Angle of input geometry (e.g. --angle 1)", cxxopts::value<Real>()->default_value("0.0"))
149144
("s,startframe", "Start frame", cxxopts::value<unsigned int>()->default_value("1"))
150145
("e,endframe", "End frame", cxxopts::value<unsigned int>())
@@ -222,18 +217,18 @@ int main( int argc, char **argv )
222217
}
223218

224219
if (result.count("scale"))
225-
scale = result["scale"].as<Vector3r>();
220+
scale = Vector3r(result["scale"].as<std::vector<Real>>().data());
226221
LOG_INFO << "Scale: " << scale;
227222

228223
if (result.count("translation"))
229-
translation = result["translation"].as<Vector3r>();
224+
translation = Vector3r(result["translation"].as<std::vector<Real>>().data());
230225
LOG_INFO << "Translation: " << translation;
231226

232227
Vector3r axis = Vector3r::Zero();
233228
Real angle = 0.0;
234229
rotation = Matrix3r::Identity();
235230
if (result.count("axis"))
236-
axis = result["axis"].as<Vector3r>();
231+
axis = Vector3r(result["axis"].as<std::vector<Real>>().data());
237232
if (result.count("angle"))
238233
{
239234
angle = result["angle"].as<Real>();

Tools/PartioViewer/GUI/imgui/PartioViewer_GUI_imgui.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
using namespace SPH;
1616

1717

18-
std::istream& operator >> (std::istream& istream, Vector3r& v)
19-
{
20-
return istream >> std::skipws >> v[0] >> v[1] >> v[2];
21-
}
22-
23-
2418
PartioViewer_GUI_imgui::PartioViewer_GUI_imgui(PartioViewer *viewer) :
2519
PartioViewer_GUI_Base()
2620
{
@@ -85,19 +79,19 @@ void PartioViewer_GUI_imgui::stop()
8579
void PartioViewer_GUI_imgui::addOptions(cxxopts::Options &options)
8680
{
8781
options.add_options()
88-
("camPos", "Camera position (e.g. --camPos \"0 1 5\")", cxxopts::value<Vector3r>()->default_value("0 3 10"))
89-
("camLookat", "Camera lookat (e.g. --camLookat \"0 0 0\")", cxxopts::value<Vector3r>()->default_value("0 0 0"))
82+
("camPos", "Camera position (e.g. --camPos 0,1,5)", cxxopts::value<std::vector<Real>>()->default_value("0,3,10"))
83+
("camLookat", "Camera lookat (e.g. --camLookat 0,0,0)", cxxopts::value<std::vector<Real>>()->default_value("0,0,0"))
9084
("showBBox", "Show bounding box.")
9185
;
9286
}
9387

9488
void PartioViewer_GUI_imgui::parseOptions(cxxopts::ParseResult &result)
9589
{
9690
if (result.count("camPos"))
97-
m_camPos = result["camPos"].as<Vector3r>();
91+
m_camPos = Vector3r(result["camPos"].as<std::vector<Real>>().data());
9892

9993
if (result.count("camLookat"))
100-
m_camLookat = result["camLookat"].as<Vector3r>();
94+
m_camLookat = Vector3r(result["camLookat"].as<std::vector<Real>>().data());
10195

10296
m_showBBox = result.count("showBBox") != 0;
10397
}

Tools/SurfaceSampling/main.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ Vector3r translation = Vector3r::Zero();
3636
Vector3r rotationAxis = Vector3r::UnitY();
3737
Real angle = 0;
3838

39-
std::istream& operator >> (std::istream& istream, Vector3r& v)
40-
{
41-
return istream >> std::skipws >> v[0] >> v[1] >> v[2];
42-
}
43-
4439

4540
// main
4641
int main( int argc, char **argv )
@@ -60,10 +55,10 @@ int main( int argc, char **argv )
6055
("i,input", "Input file (obj)", cxxopts::value<std::string>())
6156
("o,output", "Output file (bgeo)", cxxopts::value<std::string>())
6257
("r,radius", "Particle radius", cxxopts::value<Real>()->default_value("0.025"))
63-
("s,scale", "Scaling of input geometry (e.g. --scale \"1 2 3\")", cxxopts::value<Vector3r>())
58+
("s,scale", "Scaling of input geometry (e.g. --scale 1,2,3)", cxxopts::value<std::vector<Real>>())
6459
("m,mode", "Sampling mode 0 Poisson disk, 1 Regular, 2 2D sampling", cxxopts::value<unsigned int>()->default_value("1"))
65-
("t,translation", "Translation for 2D sampling (default: \"0 0 0\")", cxxopts::value<Vector3r>())
66-
("rotationAxis", "Rotation axis for 2D sampling (default: \"0 1 0\")", cxxopts::value<Vector3r>())
60+
("t,translation", "Translation for 2D sampling (default: 0,0,0)", cxxopts::value<std::vector<Real>>())
61+
("rotationAxis", "Rotation axis for 2D sampling (default: 0,1,0)", cxxopts::value<std::vector<Real>>())
6762
("a,angle", "Rotation angle for 2D simulation", cxxopts::value<Real>()->default_value("0"))
6863
;
6964

@@ -94,17 +89,17 @@ int main( int argc, char **argv )
9489
std::cout << "Radius: " << particleRadius << std::endl;
9590

9691
if (result.count("scale"))
97-
scale = result["scale"].as<Vector3r>();
92+
scale = Vector3r(result["scale"].as<std::vector<Real>>().data());
9893
std::cout << "Scale: [" << scale.transpose() << "]^T" << std::endl;
9994

10095
if (result.count("mode"))
10196
samplingMode = result["mode"].as<unsigned int>();
10297
std::cout << "Sampling mode: " << samplingMode << std::endl;
10398

10499
if (result.count("translation"))
105-
translation = result["translation"].as<Vector3r>();
100+
translation = Vector3r(result["translation"].as<std::vector<Real>>().data());
106101
if (result.count("rotationAxis"))
107-
rotationAxis = result["rotationAxis"].as<Vector3r>();
102+
rotationAxis = Vector3r(result["rotationAxis"].as<std::vector<Real>>().data());
108103
if (result.count("angle"))
109104
angle = result["angle"].as<Real>();
110105

Tools/VolumeSampling/main.cpp

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,12 @@ bool useCache = true;
6262
std::shared_ptr<Discregrid::CubicLagrangeDiscreteGrid> distanceField;
6363

6464

65-
std::istream& operator >> (std::istream& istream, SamplingBase::Region& r)
66-
{
67-
return istream >> std::skipws >> r.m_min[0] >> r.m_min[1] >> r.m_min[2] >> r.m_max[0] >> r.m_max[1] >> r.m_max[2];
68-
}
69-
70-
std::ostream& operator << (std::ostream& out, const SamplingBase::Region& r)
71-
{
72-
out << r.m_min[0] << ", " << r.m_min[1] << ", " << r.m_min[2] << ", " << r.m_max[0] << ", " << r.m_max[1] << ", " << r.m_max[2];
73-
return out;
74-
}
75-
76-
std::istream& operator >> (std::istream& istream, Eigen::Matrix<unsigned int, 3, 1>& r)
77-
{
78-
return istream >> std::skipws >> r[0] >> r[1] >> r[2];
79-
}
80-
8165
std::ostream& operator << (std::ostream& out, const Eigen::Matrix<unsigned int, 3, 1>& r)
8266
{
8367
out << r[0] << ", " << r[1] << ", " << r[2];
8468
return out;
8569
}
8670

87-
std::istream& operator >> (std::istream& istream, Vector3r& r)
88-
{
89-
return istream >> std::skipws >> r[0] >> r[1] >> r[2];
90-
}
91-
9271
std::ostream& operator << (std::ostream& out, const Vector3r& r)
9372
{
9473
out << r[0] << ", " << r[1] << ", " << r[2];
@@ -113,17 +92,17 @@ int main(int argc, char **argv)
11392
("i,input", "Input file (obj)", cxxopts::value<std::string>())
11493
("o,output", "Output file (bgeo or vtk)", cxxopts::value<std::string>())
11594
("r,radius", "Particle radius", cxxopts::value<Real>()->default_value("0.025"))
116-
("s,scale", "Scaling of input geometry (e.g. --scale \"2 1 2\")", cxxopts::value<Vector3r>()->default_value("1 1 1"))
95+
("s,scale", "Scaling of input geometry (e.g. --scale 2,1,2)", cxxopts::value<std::vector<Real>>()->default_value("1,1,1"))
11796
("m,mode", "Mode (regular=0, almost dense=1, dense=2, Jiang et al. 2015=3, Kugelstadt et al. 2021=4)", cxxopts::value<int>()->default_value("4"))
118-
("region", "Region to fill with particles (e.g. --region \"0 0 0 1 1 1\")", cxxopts::value<SamplingBase::Region>())
97+
("region", "Region to fill with particles (e.g. --region 0,0,0,1,1,1)", cxxopts::value<std::vector<Real>>())
11998
("steps", "SPH time steps", cxxopts::value<unsigned int>()->default_value("100"))
12099
("cflFactor", "CFL factor", cxxopts::value<Real>()->default_value("0.25"))
121100
("viscosity", "Viscosity coefficient (XSPH)", cxxopts::value<Real>()->default_value("0.25"))
122101
("cohesion", "Cohesion coefficient", cxxopts::value<Real>())
123102
("adhesion", "Adhesion coefficient", cxxopts::value<Real>())
124103
("stiffness", "Stiffness coefficient (only mode 3)", cxxopts::value<Real>()->default_value("10000.0"))
125104
("dt", "Time step size (only mode 3)", cxxopts::value<Real>()->default_value("0.0005"))
126-
("res", "Resolution of the Signed Distance Field (e.g. --res \"30 30 30\")", cxxopts::value<Eigen::Matrix<unsigned int, 3, 1>>())
105+
("res", "Resolution of the Signed Distance Field (e.g. --res 30,30,30)", cxxopts::value<std::vector<unsigned int>>())
127106
("invert", "Invert the SDF to sample the outside of the object in the bounding box/region")
128107
("no-cache", "Disable caching of SDF.")
129108
;
@@ -182,7 +161,7 @@ int main(int argc, char **argv)
182161
LOG_INFO << "Radius: " << radius;
183162

184163
if (result.count("scale"))
185-
scale = result["scale"].as<Vector3r>();
164+
scale = Vector3r(result["scale"].as<std::vector<Real>>().data());
186165
LOG_INFO << "Scale: " << scale;
187166

188167
if (result.count("steps"))
@@ -213,7 +192,7 @@ int main(int argc, char **argv)
213192

214193
if (result.count("res"))
215194
{
216-
resolutionSDF = result["res"].as<Eigen::Matrix<unsigned int, 3, 1>>();
195+
resolutionSDF = Eigen::Matrix<unsigned int, 3, 1>(result["res"].as<std::vector<unsigned int>>().data());
217196
LOG_INFO << "SDF resolution: " << resolutionSDF;
218197
}
219198

@@ -227,9 +206,14 @@ int main(int argc, char **argv)
227206

228207
if (result.count("region"))
229208
{
230-
region = result["region"].as<SamplingBase::Region>();
209+
const std::vector<Real> &v = result["region"].as<std::vector<Real>>();
210+
if (v.size() == 6)
211+
region = SamplingBase::Region(v[0], v[1], v[2], v[3], v[4], v[5]);
212+
else
213+
LOG_WARN << "Region parameter has wrong number of elements.";
231214
useRegion = true;
232-
LOG_INFO << "Region: " << region;
215+
LOG_INFO << "Region - min: " << region.m_min.transpose();
216+
LOG_INFO << "Region - max: " << region.m_max.transpose();
233217
}
234218
}
235219
catch (const cxxopts::exceptions::exception& e)

0 commit comments

Comments
 (0)