Commit bb09f1c6 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

Merge branch 'feature/cleanup-exceptions' into 'master'

[exceptions] remove unneccessary std::string() around messages

See merge request DennisGlaeser/frackit!22
parents ee608877 dbd39eb9
......@@ -67,7 +67,7 @@ ctype computeDistance(const TopoDS_Shape& shape1,
{
BRepExtrema_DistShapeShape algo(shape1, shape2, deflection, extFlag, extAlgo);
if (!algo.IsDone())
throw std::runtime_error(std::string("Could not compute BRep distance"));
throw std::runtime_error("Could not compute BRep distance");
return algo.Value();
}
......
......@@ -57,7 +57,7 @@ namespace ConstraintImpl {
msg += "\"" + geometryName(is) + "\"";
msg += " and entity geometry ";
msg += "\"" + geometryName(entity) + "\"";
throw std::runtime_error(std::string(msg));
throw std::runtime_error(msg);
}
/*!
......@@ -158,7 +158,7 @@ namespace ConstraintImpl {
bool isAdmissibleDistanceToBoundary(const TopoDS_Face& face,
const Disk<ctype>& entity,
ctype2 threshold)
{ throw std::runtime_error(std::string("NotImplemented: face-entity boundary distance")); }
{ throw std::runtime_error("NotImplemented: face-entity boundary distance"); }
/*!
* \brief Overload for edge intersections on faces.
......@@ -182,7 +182,7 @@ namespace ConstraintImpl {
bool isAdmissibleDistanceToBoundary(const TopoDS_Face& face,
const TopoDS_Face& entity,
ctype threshold)
{ throw std::runtime_error(std::string("NotImplemented: face-entity boundary distance")); }
{ throw std::runtime_error("NotImplemented: face-entity boundary distance"); }
/*!
* \brief Overload for std::variant.
......
......@@ -233,7 +233,7 @@ protected:
intersection.SetFuzzyValue(getEpsilon_());
intersection.Build();
if(!intersection.IsDone())
throw std::runtime_error(std::string("Could not confine network"));
throw std::runtime_error("Could not confine network");
// keep track of original entity indices
TopTools_ListOfShape newList;
......@@ -242,7 +242,7 @@ protected:
{
int entityIdx;
if (!fragmentMap.Find(it.Value(), entityIdx))
throw std::runtime_error(std::string("Could not find entity index"));
throw std::runtime_error("Could not find entity index");
// map all fragments to this new index
const bool isDeleted = intersection.IsDeleted(it.Value());
......@@ -319,7 +319,7 @@ protected:
fragmentAlgo.SetFuzzyValue(getEpsilon_());
fragmentAlgo.Build();
if(!fragmentAlgo.IsDone())
throw std::runtime_error(std::string("Could not perform fragmentation"));
throw std::runtime_error("Could not perform fragmentation");
// map the resulting entities back to the original entity index
std::unordered_map<std::size_t, TopTools_ListOfShape> newFragmentLists;
......@@ -329,13 +329,13 @@ protected:
// get subdomain index
int subDomainIdx;
if (!entityToSubDomainIndex.Find(it.Value(), subDomainIdx))
throw std::runtime_error(std::string("Could not find sub-domain index"));
throw std::runtime_error("Could not find sub-domain index");
// get original entity index
int entityIdx;
const auto& map = networkFragmentMaps_.at(subDomainIdx);
if (!map.Find(it.Value(), entityIdx))
throw std::runtime_error(std::string("Could not find original entity index"));
throw std::runtime_error("Could not find original entity index");
// map all fragments to this new index
const bool isDeleted = fragmentAlgo.IsDeleted(it.Value());
......@@ -372,7 +372,7 @@ protected:
// get subdomain index
int subDomainIdx;
if (!domainToSubDomainIndex.Find(it.Value(), subDomainIdx))
throw std::runtime_error(std::string("Could not find sub-domain index"));
throw std::runtime_error("Could not find sub-domain index");
// store the fragments of this sub-domain
const bool isDeleted = fragmentAlgo.IsDeleted(it.Value());
......
......@@ -106,7 +106,7 @@ public:
using std::abs;
const auto eps = bottom.majorAxisLength()*Precision<ctype>::confusion();
if (abs(bottom.majorAxisLength() - bottom.minorAxisLength()) > eps)
throw std::runtime_error(std::string("Cylinder requires circular disks as base"));
throw std::runtime_error("Cylinder requires circular disks as base");
}
//! Return the name of the geometry
......
......@@ -168,7 +168,7 @@ public:
{
if (checkIfOnEllipse)
if (!contains(p))
throw std::runtime_error(std::string("Point not on ellipse!"));
throw std::runtime_error("Point not on ellipse!");
const auto d = Vector(this->center(), p);
const auto x = d*Vector(this->majorAxis());
......
......@@ -133,7 +133,7 @@ public:
case 1: return Segment(corners_[1], corners_[3]);
case 2: return Segment(corners_[0], corners_[2]);
case 3: return Segment(corners_[2], corners_[3]);
default: throw std::runtime_error(std::string("Invalid edge index"));
default: throw std::runtime_error("Invalid edge index");
}
}
......
......@@ -122,7 +122,7 @@ public:
case 0: return Segment(corners_[0], corners_[1]);
case 1: return Segment(corners_[1], corners_[2]);
case 2: return Segment(corners_[2], corners_[0]);
default: throw std::runtime_error(std::string("Invalid edge index"));
default: throw std::runtime_error("Invalid edge index");
}
}
......
......@@ -114,9 +114,9 @@ intersect_disk_disk(const Disk<ctype>& disk1,
// if the result is a plane, find the intersection surface
else if (std::holds_alternative<Plane<ctype, worldDim>>(planeIS))
throw std::runtime_error(std::string("NotImplemented: planar disk-disk intersections"));
throw std::runtime_error("NotImplemented: planar disk-disk intersections");
throw std::runtime_error(std::string("Unexpected plane-plane intersection result"));
throw std::runtime_error("Unexpected plane-plane intersection result");
}
} // end namespace IntersectionAlgorithms
......
......@@ -117,10 +117,10 @@ intersect_disk_line(const Disk<ctype>& disk,
}
}
throw std::runtime_error(std::string("Unexpected code behaviour"));
throw std::runtime_error("Unexpected code behaviour");
}
throw std::runtime_error(std::string("Unexpected Plane-Line intersection result"));
throw std::runtime_error("Unexpected Plane-Line intersection result");
}
} // end namespace IntersectionAlgorithms
......
......@@ -58,7 +58,7 @@ find_touching_points(const TopoDS_Face& face,
// cut the wire by the shape and check if new edges were created
const auto faceWires = OCCUtilities::getWires(face);
if (faceWires.size() != 1)
throw std::runtime_error(std::string("Algorithm expects face bounded by a single wire"));
throw std::runtime_error("Algorithm expects face bounded by a single wire");
const auto wireCut = OCCUtilities::cut(faceWires[0], shape, eps);
......
......@@ -70,7 +70,7 @@ intersect_plane_line(const Plane<ctype, 3>& plane,
Handle(Geom_Line) lineHandle = new Geom_Line(linePoint, lineDir);
GeomAPI_IntCS interSection(lineHandle, planeHandle);
if (!interSection.IsDone())
throw std::runtime_error(std::string("Could not perform disk-line intersection"));
throw std::runtime_error("Could not perform disk-line intersection");
assert(interSection.NbSegments() == 0);
assert(interSection.NbPoints() == 1);
......
......@@ -74,7 +74,7 @@ intersect_plane_plane(const Plane<ctype, 3>& plane1,
Handle(Geom_Plane) gpPlane2 = new Geom_Plane(c2, d2);
GeomAPI_IntSS interSection(gpPlane1, gpPlane2, eps);
if (!interSection.IsDone())
throw std::runtime_error(std::string("Could not perform plane-plane intersection"));
throw std::runtime_error("Could not perform plane-plane intersection");
assert(interSection.NbLines() == 1);
assert(!interSection.Line(1)->IsClosed());
......
......@@ -114,7 +114,7 @@ intersect_segment_segment(const Segment<ctype, wd>& segment1,
}
}
throw std::runtime_error(std::string("Could not find intersection point"));
throw std::runtime_error("Could not find intersection point");
}
// a pair of corners being equal is the last possible option
......
......@@ -57,7 +57,7 @@ intersect_shell_disk(const TopoDS_Shell& shell,
BRepBuilderAPI_MakeSolid makeSolid(shell);
makeSolid.Build();
if (!makeSolid.IsDone())
throw std::runtime_error(std::string("Could not build solid"));
throw std::runtime_error("Could not build solid");
const auto& solid = TopoDS::Solid(makeSolid.Shape());
const auto& diskFace = OCCUtilities::getShape(disk);
......
......@@ -123,7 +123,7 @@ namespace OCCUtilities {
//! get the BRep of a geometry (overloads provided)
template<class Geo>
TopoDS_Shape getShape(const Geo& p)
{ throw std::runtime_error(std::string("getShape() not implemented for " + Geo::name())); }
{ throw std::runtime_error("getShape() not implemented for " + Geo::name()); }
//! get the BRep of a point
template<class ctype, int worldDim>
......@@ -156,7 +156,7 @@ namespace OCCUtilities {
2.0*M_PI);
makeCylinder.Build();
if (!makeCylinder.IsDone())
throw std::runtime_error(std::string("Could not build cylinder"));
throw std::runtime_error("Could not build cylinder");
return TopoDS::Solid(makeCylinder.Shape());
}
......@@ -174,7 +174,7 @@ namespace OCCUtilities {
2.0*M_PI);
makeCylinder.Build();
if (!makeCylinder.IsDone())
throw std::runtime_error(std::string("Could not build cylinder"));
throw std::runtime_error("Could not build cylinder");
return makeCylinder.Cylinder().LateralFace();
}
......@@ -252,7 +252,7 @@ namespace OCCUtilities {
BRepPrimAPI_MakeBox makeBox(pMin, pMax);
makeBox.Build();
if (!makeBox.IsDone())
throw std::runtime_error(std::string("Could not build box"));
throw std::runtime_error("Could not build box");
return TopoDS::Solid(makeBox.Shape());
}
......@@ -347,7 +347,7 @@ namespace OCCUtilities {
cut.SetFuzzyValue(eps);
cut.Build();
if (!cut.IsDone())
throw std::runtime_error(std::string("Could not perform cut operation"));
throw std::runtime_error("Could not perform cut operation");
return cut.Shape();
}
......@@ -361,7 +361,7 @@ namespace OCCUtilities {
common.SetFuzzyValue(eps);
common.Build();
if (!common.IsDone())
throw std::runtime_error(std::string("Common operation failed"));
throw std::runtime_error("Common operation failed");
return common.Shape();
}
......@@ -380,7 +380,7 @@ namespace OCCUtilities {
fragments.SetFuzzyValue(eps);
fragments.Build();
if (!fragments.IsDone())
throw std::runtime_error(std::string("Could not perform fragmentation"));
throw std::runtime_error("Could not perform fragmentation");
return fragments.Shape();
}
......@@ -400,7 +400,7 @@ namespace OCCUtilities {
fuse.SetFuzzyValue(eps);
fuse.Build();
if (!fuse.IsDone())
throw std::runtime_error(std::string("Could not perform union"));
throw std::runtime_error("Could not perform union");
return fuse.Shape();
}
......
......@@ -36,33 +36,33 @@ int main()
auto d = Frackit::computeDistance(Disk(Point(0.0, 0.0, 0.0), e1, e2, f, 0.5*f),
Disk(Point(0.0, 0.0, f), e1, e2, f, 0.5*f));
if ( abs(d - f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Test 1 failed"));
throw std::runtime_error("Test 1 failed");
d = Frackit::computeDistance(Disk(Point(0.0, 0.0, 0.0), e1, e2, f, 0.5*f),
Disk(Point(f, 0.0, f), e1, e2, f, 0.5*f));
if ( abs(d - f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Test 2 failed"));
throw std::runtime_error("Test 2 failed");
d = Frackit::computeDistance(Disk(Point(0.0, 0.0, 0.0), e1, e2, f, 0.5*f),
Disk(Point(3.0*f, 0.0, f), e1, e2, f, 0.5*f));
if ( abs(d - sqrt(2.0)*f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Test 3 failed"));
throw std::runtime_error("Test 3 failed");
// orthogonal disks being closest in the middle
d = Frackit::computeDistance(Disk(Point(0.0, 0.0, 0.0), e1, e2, f, 0.5*f),
Disk(Point(0.0, 0.0, 2.0*f), e1, e3, f, f));
if ( abs(d - f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Test 4 failed"));
throw std::runtime_error("Test 4 failed");
d = Frackit::computeDistance(Disk(Point(0.0, 0.0, 0.0), e1, e2, f, 0.5*f),
Disk(Point(0.0, 0.0, 1.0*f + 1e-3*f), e1, e3, f, f));
if ( abs(d - 1e-3*f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Test 5 failed"));
throw std::runtime_error("Test 5 failed");
d = Frackit::computeDistance(Disk(Point(0.0, 0.0, 0.0), e1, e2, f, 0.5*f),
Disk(Point(0.0, 0.0, 1.0*f), e1, e3, f, 0.5*f));
if ( abs(d - 0.5*f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Test 6 failed"));
throw std::runtime_error("Test 6 failed");
// compute the distance of an ellipse arc to a disk, which
// results from the intersection of a disk with a cylinder surface
......@@ -70,14 +70,14 @@ int main()
Disk disk(Point(0.25*f, 0.0, 0.5*f), e1, e2, 0.5*f, 0.25*f);
auto is = Frackit::intersect(cylSurface, disk);
if (is.size() != 1)
throw std::runtime_error(std::string("Unexpected number of intersections"));
throw std::runtime_error("Unexpected number of intersections");
if (!std::holds_alternative<Frackit::EllipseArc<ctype, 3>>(is[0]))
throw std::runtime_error(std::string("Unexpected intersection type"));
throw std::runtime_error("Unexpected intersection type");
const auto& arc = std::get<Frackit::EllipseArc<ctype, 3>>(is[0]);
d = Frackit::computeDistance(cylSurface.upperBoundingCircle(), arc);
if ( abs(d - 0.5*f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Test 7 failed"));
throw std::runtime_error("Test 7 failed");
// do the same with an inclined disk
Direction e22(Vector(0.0, 1.0, 1.0));
......@@ -85,20 +85,20 @@ int main()
is = Frackit::intersect(cylSurface, disk2);
if (is.size() != 1)
throw std::runtime_error(std::string("Unexpected number of intersections"));
throw std::runtime_error("Unexpected number of intersections");
if (!std::holds_alternative<Frackit::EllipseArc<ctype, 3>>(is[0]))
throw std::runtime_error(std::string("Unexpected intersection type"));
throw std::runtime_error("Unexpected intersection type");
const auto& arc2 = std::get<Frackit::EllipseArc<ctype, 3>>(is[0]);
const auto eps = Frackit::Precision<ctype>::confusion()*f;
if (!arc2.getPoint(0.5).isEqual(Point(0.5*f, 0.0, 0.5*f), eps))
throw std::runtime_error(std::string("Unexpected intersection arc"));
throw std::runtime_error("Unexpected intersection arc");
using std::max;
const auto zMax = max(arc2.getPoint(0.0).z(), arc2.getPoint(1.0).z());
d = Frackit::computeDistance(cylSurface.upperBoundingCircle(), arc2);
if ( abs(d - (f- zMax)) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Test 8 failed"));
throw std::runtime_error("Test 8 failed");
}
std::cout << "All tests passed" << std::endl;
......
......@@ -29,31 +29,31 @@ int main()
// distance between two points
auto d = computeDistance(Point(0.0, 0.0, 0.0), Point(f, 0.0, 0.0));
if ( abs(d - f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Point-Point distance wrong"));
throw std::runtime_error("Point-Point distance wrong");
// distance between line and point
d = computeDistance(Point(0.0, 0.0, 0.0),
Line(Point(0.0, f, 0.0), Vector(0.0, 0.0, 1.0)));
if ( abs(d - f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Point-Line distance wrong"));
throw std::runtime_error("Point-Line distance wrong");
// distance between segment and point (center)
d = computeDistance(Point(0.0, 0.0, 0.0),
Segment(Point(0.0, -f, f), Point(0.0, f, f)));
if ( abs(d - f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Point-Segment distance wrong (1)"));
throw std::runtime_error("Point-Segment distance wrong (1)");
// distance between segment and point (corner)
d = computeDistance(Point(0.0, 0.0, 0.0),
Segment(Point(0.0, 0.0, f), Point(0.0, f, f)));
if ( abs(d - f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Point-Segment distance wrong (2)"));
throw std::runtime_error("Point-Segment distance wrong (2)");
// distance between segment and point (corner)
d = computeDistance(Point(0.0, 0.0, 0.0),
Segment(Point(0.0, f, f), Point(0.0, 2.0*f, f)));
if ( abs(d - sqrt(2.0)*f) > Frackit::Precision<ctype>::confusion()*f )
throw std::runtime_error(std::string("Point-Segment distance wrong (3)"));
throw std::runtime_error("Point-Segment distance wrong (3)");
}
std::cout << "All tests passed" << std::endl;
......
......@@ -35,50 +35,50 @@ int main()
// violates distance constraint
Disk disk1(Point(0.0, 0.0, 0.5), e1, e2, 0.4+1e-5, 0.25);
if (constraints.evaluate(cylSurface, disk1))
throw std::runtime_error(std::string("Did not detect distance violation"));
throw std::runtime_error("Did not detect distance violation");
std::cout << "Test 1 passed" << std::endl;
// just doesn't violate distance constraint
Disk disk2(Point(0.0, 0.0, 0.5), e1, e2, 0.4-1e-5, 0.25);
if (!constraints.evaluate(cylSurface, disk2))
throw std::runtime_error(std::string("False positive distance violation"));
throw std::runtime_error("False positive distance violation");
std::cout << "Test 2 passed" << std::endl;
// violates the intersection magnitude constraint
Disk disk3(Point(0.4, 0.0, 0.5), e1, e2, 0.11, 0.05);
if (constraints.evaluate(cylSurface, disk3))
throw std::runtime_error(std::string("Did not detect intersection magnitude violation"));
throw std::runtime_error("Did not detect intersection magnitude violation");
std::cout << "Test 3 passed" << std::endl;
// does not violate the intersection magnitude constraint
Disk disk4(Point(0.4, 0.0, 0.5), e1, e2, 0.5, 0.5);
if (!constraints.evaluate(cylSurface, disk4))
throw std::runtime_error(std::string("False positive intersection magnitude violation"));
throw std::runtime_error("False positive intersection magnitude violation");
std::cout << "Test 4 passed" << std::endl;
// violates the distance to boundary constraint
Disk disk5(Point(0.4, 0.0, 0.95 + 1e-6), e1, e2, 0.5, 0.5);
if (constraints.evaluate(cylSurface, disk5))
throw std::runtime_error(std::string("Did not detect distance to boundary violation"));
throw std::runtime_error("Did not detect distance to boundary violation");
std::cout << "Test 5 passed" << std::endl;
// does not violate the distance to boundary constraint
Disk disk6(Point(0.4, 0.0, 0.95 - 1e-6), e1, e2, 0.5, 0.5);
if (!constraints.evaluate(cylSurface, disk6))
throw std::runtime_error(std::string("False positive intersection magnitude violation"));
throw std::runtime_error("False positive intersection magnitude violation");
std::cout << "Test 6 passed" << std::endl;
// violates the intersection angle constraint
const Vector e12(1.0, 0.0, 1.0 + 1e-3);
Disk disk7(Point(0.4, 0.0, 0.5), e12, e2, 0.5, 0.5);
if (constraints.evaluate(cylSurface, disk7))
throw std::runtime_error(std::string("Did not detect intersection angle violation"));
throw std::runtime_error("Did not detect intersection angle violation");
std::cout << "Test 7 passed" << std::endl;
// does not violate the distance to boundary constraint
Disk disk8(Point(0.4, 0.0, 0.95 - 1e-6), e1, e2, 0.5, 0.5);
if (!constraints.evaluate(cylSurface, disk6))
throw std::runtime_error(std::string("False positive intersection magnitude violation"));
throw std::runtime_error("False positive intersection magnitude violation");
std::cout << "Test 6 passed" << std::endl;
// TODO: Test elliptical intersection
......
......@@ -34,76 +34,76 @@ int main()
// violates distance constraint
Disk disk1(Point(0.0, 0.0, 0.1-1e-3), e1, e2, 1.0, 1.0);
if (constraints.evaluate(mainDisk, disk1))
throw std::runtime_error(std::string("Did not detect distance violation"));
throw std::runtime_error("Did not detect distance violation");
std::cout << "Test 1 passed" << std::endl;
// just doesn't violates distance constraint
Disk disk2(Point(0.0, 0.0, 0.1+1e-3), e1, e2, 1.0, 1.0);
if (!constraints.evaluate(mainDisk, disk2))
throw std::runtime_error(std::string("Detected false positive distance violation"));
throw std::runtime_error("Detected false positive distance violation");
std::cout << "Test 2 passed" << std::endl;
// violates distance constraint (orthogonal)
Disk disk3(Point(0.0, 0.0, 1.1-1e-3), e1, e3, 1.0, 1.0);
if (constraints.evaluate(mainDisk, disk3))
throw std::runtime_error(std::string("Did not detect distance violation"));
throw std::runtime_error("Did not detect distance violation");
std::cout << "Test 3 passed" << std::endl;
// just doesn't violates distance constraint (orthogonal)
Disk disk4(Point(0.0, 0.0, 1.1+1e-3), e1, e3, 1.0, 1.0);
if (!constraints.evaluate(mainDisk, disk4))
throw std::runtime_error(std::string("Detected false positive distance violation"));
throw std::runtime_error("Detected false positive distance violation");
std::cout << "Test 4 passed" << std::endl;
// too small intersection
Disk disk5(Point(0.0, 0.0, 1.0-1e-4), e1, e3, 1.0, 1.0);
if (constraints.evaluate(mainDisk, disk5))
throw std::runtime_error(std::string("Did not detect intersection magnitude violation"));
throw std::runtime_error("Did not detect intersection magnitude violation");
std::cout << "Test 5 passed" << std::endl;
// intersection magnitude ok
Disk disk6(Point(0.0, 0.0, 0.8), e1, e3, 1.0, 1.0);
if (!constraints.evaluate(mainDisk, disk6))
throw std::runtime_error(std::string("False positive intersection magnitude violation"));
throw std::runtime_error("False positive intersection magnitude violation");
std::cout << "Test 6 passed" << std::endl;
// intersection magnitude ok, but distance to boundary is too small
Disk disk7(Point(0.38, 0.0, 0.8), e1, e3, 1.0, 1.0);
if (constraints.evaluate(mainDisk, disk7))
throw std::runtime_error(std::string("Did not detect intersection distance violation"));
throw std::runtime_error("Did not detect intersection distance violation");
std::cout << "Test 7 passed" << std::endl;
// intersection angle just ok
const Vector e22(0.0, 1.0, 1.0 + 1e-3);
Disk disk8(Point(0.0, 0.0, 0.0), e1, e22, 1.0, 1.0);
if (!constraints.evaluate(mainDisk, disk8))
throw std::runtime_error(std::string("False positive intersection angle violation"));
throw std::runtime_error("False positive intersection angle violation");
std::cout << "Test 8 passed" << std::endl;
// intersection angle too small
const Vector e23(0.0, 1.0, 1.0 - 1e-3);
Disk disk9(Point(0.0, 0.0, 0.0), e1, e23, 1.0, 1.0);
if (constraints.evaluate(mainDisk, disk9))
throw std::runtime_error(std::string("Did not detect intersection angle violation"));
throw std::runtime_error("Did not detect intersection angle violation");
std::cout << "Test 9 passed" << std::endl;
// Test constraints w.r.t. cylinder
Frackit::Cylinder<ctype> cylinder(0.5, 1.0);
Disk disk10(Point(0.0, 0.0, 0.5), e1, e2, 2.0, 2.0);
if (!constraints.evaluate(cylinder.lateralFace(), disk10))
throw std::runtime_error(std::string("False positive intersection distance violation"));
throw std::runtime_error("False positive intersection distance violation");
std::cout << "Test 10 passed" << std::endl;
// violates intersection distance constraint
Disk disk11(Point(0.0, 0.0, 0.951), e1, e2, 2.0, 2.0);
if (constraints.evaluate(cylinder.lateralFace(), disk11))
throw std::runtime_error(std::string("Did not detect intersection distance violation"));
throw std::runtime_error("Did not detect intersection distance violation");
std::cout << "Test 11 passed" << std::endl;
// just doesn't violate intersection distance constraint
Disk disk12(Point(0.0, 0.0, 0.849), e1, e2, 2.0, 2.0);
if (!constraints.evaluate(cylinder.lateralFace(), disk12))
throw std::runtime_error(std::string("False positive intersection distance violation"));
throw std::runtime_error("False positive intersection distance violation");
std::cout << "Test 12 passed" << std::endl;
std::cout << "All tests passed" << std::endl;
......
......@@ -33,7 +33,7 @@ int main(int argc, char** argv)
// brep file name is specified in CMakeLists.txt
std::ifstream domainShapeFile(BREPFILE);
if (!domainShapeFile)
throw std::runtime_error(std::string("Could not open shape file"));
throw std::runtime_error("Could not open shape file");
TopoDS_Shape domainShape;
BRepTools::Read(domainShape, domainShapeFile, BRep_Builder());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment