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

[python] move brepwrappers to geometry module

parent c932b0a5
......@@ -35,8 +35,7 @@ if len(domainBoundaryFaces) != 6: raise RuntimeError("Expected 6 faces to bound
# Bounding box of the domain in which we want to place the entities
# In order for this to work we parse the solid back into a wrapper around a BRep shape
from frackit.geometry import Box
from frackit.occutilities import OCCShapeWrapper
from frackit.geometry import Box, OCCShapeWrapper
domainBBox = getBoundingBox( OCCShapeWrapper(networkDomain) )
# creates a uniform sampler within an interval
......
......@@ -20,7 +20,7 @@
#define FRACKIT_PYTHON_EXTRACT_CTYPE_HH
#include <frackit/common/extractctype.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/python/geometry/brepwrapper.hh>
namespace Frackit::Python {
......@@ -31,7 +31,7 @@ struct CoordinateTypeTraits
: public Frackit::CoordinateTypeTraits<Geo> {};
template<class S>
struct CoordinateTypeTraits<OCCUtilities::BRepWrapper<S>>
struct CoordinateTypeTraits<BRepWrapper<S>>
: public Frackit::CoordinateTypeTraits<S> {};
} // end namespace Frackit::Python
......
......@@ -29,7 +29,7 @@
#include <frackit/geometry/quadrilateral.hh>
#include <frackit/entitynetwork/constraints.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/python/geometry/brepwrapper.hh>
namespace Frackit::Python {
......@@ -48,19 +48,7 @@ namespace Detail {
// evaluate the constraint between two geometries
template<class Geo1, class Geo2>
bool evaluateBinary(const Geo1& geo1, const Geo2& geo2) const
{
static constexpr auto isWrapper1 = OCCUtilities::IsBRepWrapper<Geo1>::value;
static constexpr auto isWrapper2 = OCCUtilities::IsBRepWrapper<Geo2>::value;
if constexpr (!isWrapper1 && !isWrapper2)
return ParentType::evaluate(geo1, geo2);
else if constexpr (!isWrapper1 && isWrapper2)
return ParentType::evaluate(geo1, geo2.get());
else if constexpr (isWrapper1 && !isWrapper2)
return ParentType::evaluate(geo1.get(), geo2);
else
return ParentType::evaluate(geo1.get(), geo2.get());
}
{ return ParentType::evaluate(getUnwrappedShape(geo1), getUnwrappedShape(geo2)); }
};
template<class Constraints>
......@@ -104,7 +92,7 @@ namespace Detail {
// types for which this ought to be able to evaluate
using Disk = Frackit::Disk<ctype>;
using Quad_3 = Frackit::Quadrilateral<ctype, 3>;
using Face = OCCUtilities::FaceWrapper;
using Face = FaceWrapper;
registerBinaryEvaluator<Disk, Disk>(cls);
registerBinaryEvaluator<Disk, Quad_3>(cls);
......
......@@ -28,7 +28,7 @@
// (currently) supported entity geometries
#include <frackit/geometry/disk.hh>
#include <frackit/geometry/quadrilateral.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/python/geometry/brepwrapper.hh>
#include <frackit/common/id.hh>
#include <frackit/entitynetwork/networkbuilder.hh>
......@@ -68,7 +68,7 @@ namespace Detail {
{
registerSubDomainAdder< Box<ctype> >(cls);
registerSubDomainAdder< Cylinder<ctype> >(cls);
registerSubDomainAdder< OCCUtilities::SolidWrapper >(cls);
registerSubDomainAdder< SolidWrapper >(cls);
}
template<class ctype, class Wrapper, class... Bases>
......@@ -76,7 +76,7 @@ namespace Detail {
{
registerSubDomainEntityAdder< Disk<ctype> >(cls);
registerSubDomainEntityAdder< Quadrilateral<ctype, 3> >(cls);
registerSubDomainEntityAdder< OCCUtilities::FaceWrapper >(cls);
registerSubDomainEntityAdder< FaceWrapper >(cls);
}
template<class ctype, class Wrapper, class... Bases>
......@@ -84,7 +84,7 @@ namespace Detail {
{
registerEntityAdder< Disk<ctype> >(cls);
registerEntityAdder< Quadrilateral<ctype, 3> >(cls);
registerEntityAdder< OCCUtilities::FaceWrapper >(cls);
registerEntityAdder< FaceWrapper >(cls);
}
} // end namespace detail
......
......@@ -19,7 +19,7 @@
#ifndef FRACKIT_PYTHON_ENTITYNETWORK_BUILDER_WRAPPERS_HH
#define FRACKIT_PYTHON_ENTITYNETWORK_BUILDER_WRAPPERS_HH
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/python/geometry/brepwrapper.hh>
#include <frackit/entitynetwork/networkbuilder.hh>
#include <frackit/common/id.hh>
......@@ -28,6 +28,7 @@ namespace Frackit::Python {
namespace Detail {
// Wrappers around the builder classes to support brep wrappers
// we use the convenience function getUnwrappedShape() to support all types
template<class ctype>
class EntityNetworkBuilderWrapper
: public EntityNetworkBuilder<ctype>
......@@ -37,36 +38,19 @@ namespace Detail {
public:
template<class Entity>
void addSubDomainEntity(const Entity& entity, Id subDomainId)
{
if constexpr (OCCUtilities::IsBRepWrapper<Entity>::value)
ParentType::addSubDomainEntity(entity.get(), subDomainId);
else
ParentType::addSubDomainEntity(entity, subDomainId);
}
{ ParentType::addSubDomainEntity(getUnwrappedShape(entity), subDomainId); }
template<class Entity>
void addEntity(const Entity& entity)
{
addSubDomainEntity(entity, Id(0));
}
{ addSubDomainEntity(entity, Id(0)); }
template<class Domain>
void addConfiningSubDomain(const Domain& domain, Id subDomainId)
{
if constexpr (OCCUtilities::IsBRepWrapper<Domain>::value)
ParentType::addConfiningSubDomain(domain.get(), subDomainId);
else
ParentType::addConfiningSubDomain(domain, subDomainId);
}
{ ParentType::addConfiningSubDomain(getUnwrappedShape(domain), subDomainId); }
template<class Domain>
void addSubDomain(const Domain& domain, Id subDomainId)
{
if constexpr (OCCUtilities::IsBRepWrapper<Domain>::value)
ParentType::addSubDomain(domain.get(), subDomainId);
else
ParentType::addSubDomain(domain, subDomainId);
}
{ ParentType::addSubDomain(getUnwrappedShape(domain), subDomainId); }
};
template<class ctype>
......@@ -78,30 +62,15 @@ namespace Detail {
public:
template<class Entity>
void addSubDomainEntity(const Entity& entity, Id subDomainId)
{
if constexpr (OCCUtilities::IsBRepWrapper<Entity>::value)
ParentType::addSubDomainEntity(entity.get(), subDomainId);
else
ParentType::addSubDomainEntity(entity, subDomainId);
}
{ ParentType::addSubDomainEntity(getUnwrappedShape(entity), subDomainId); }
template<class Domain>
void addConfiningSubDomain(const Domain& domain, Id subDomainId)
{
if constexpr (OCCUtilities::IsBRepWrapper<Domain>::value)
ParentType::addConfiningSubDomain(domain.get(), subDomainId);
else
ParentType::addConfiningSubDomain(domain, subDomainId);
}
{ ParentType::addConfiningSubDomain(getUnwrappedShape(domain), subDomainId); }
template<class Domain>
void addSubDomain(const Domain& domain, Id subDomainId)
{
if constexpr (OCCUtilities::IsBRepWrapper<Domain>::value)
ParentType::addSubDomain(domain.get(), subDomainId);
else
ParentType::addSubDomain(domain, subDomainId);
}
{ ParentType::addSubDomain(getUnwrappedShape(domain), subDomainId); }
};
} // end namespace Detail
......
install(FILES
box.hh
brepwrapper.hh
brepwrappers.hh
circle.hh
cylinder.hh
cylindersurface.hh
......
......@@ -16,8 +16,8 @@
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef FRACKIT_PYTHON_OCC_BREP_WRAPPER_HH
#define FRACKIT_PYTHON_OCC_BREP_WRAPPER_HH
#ifndef FRACKIT_PYTHON_GEOMETRY_OCC_BREP_WRAPPER_HH
#define FRACKIT_PYTHON_GEOMETRY_OCC_BREP_WRAPPER_HH
#include <type_traits>
......@@ -33,7 +33,7 @@
#include <frackit/geometryutilities/name.hh>
namespace Frackit::Python::OCCUtilities {
namespace Frackit::Python {
// Wrapper class to be used around occ brep classes
template<class S>
......@@ -152,6 +152,6 @@ template<class Geo, std::enable_if_t<!std::is_convertible_v<Geo, TopoDS_Shape>,
const Geo& getWrappedShape(const Geo& geo)
{ return geo; }
} // end namespace Frackit::Python::OCCUtilities
} // end namespace Frackit::Python
#endif
......@@ -16,12 +16,13 @@
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef FRACKIT_PYTHON_OCC_BREP_WRAPPERS_HH
#define FRACKIT_PYTHON_OCC_BREP_WRAPPERS_HH
#ifndef FRACKIT_PYTHON_GEOMETRY_OCC_BREP_WRAPPERS_HH
#define FRACKIT_PYTHON_GEOMETRY_OCC_BREP_WRAPPERS_HH
#include <type_traits>
#include <pybind11/pybind11.h>
#include <TopoDS_Shape.hxx>
#include "brepwrapper.hh"
namespace Frackit::Python {
......@@ -32,7 +33,7 @@ namespace Detail {
void registerBRepWrapper(pybind11::module& module,
const std::string& className)
{
using Wrapper = OCCUtilities::BRepWrapper<Shape>;
using Wrapper = BRepWrapper<Shape>;
pybind11::class_<Wrapper> cls(module, className.c_str());
cls.def("name", &Wrapper::name, "return the name of the wrapper");
......@@ -40,25 +41,24 @@ namespace Detail {
if constexpr(std::is_same_v<Shape, TopoDS_Shape>)
{
namespace py = pybind11;
cls.def(py::init<OCCUtilities::ShapeWrapper>(), "construction from another brep wrapper");
cls.def(py::init<OCCUtilities::VertexWrapper>(), "construction from another brep wrapper");
cls.def(py::init<OCCUtilities::EdgeWrapper>(), "construction from another brep wrapper");
cls.def(py::init<OCCUtilities::WireWrapper>(), "construction from another brep wrapper");
cls.def(py::init<OCCUtilities::FaceWrapper>(), "construction from another brep wrapper");
cls.def(py::init<OCCUtilities::ShellWrapper>(), "construction from another brep wrapper");
cls.def(py::init<OCCUtilities::SolidWrapper>(), "construction from another brep wrapper");
cls.def(py::init<OCCUtilities::CompoundWrapper>(), "construction from another brep wrapper");
cls.def(py::init<ShapeWrapper>(), "construction from another brep wrapper");
cls.def(py::init<VertexWrapper>(), "construction from another brep wrapper");
cls.def(py::init<EdgeWrapper>(), "construction from another brep wrapper");
cls.def(py::init<WireWrapper>(), "construction from another brep wrapper");
cls.def(py::init<FaceWrapper>(), "construction from another brep wrapper");
cls.def(py::init<ShellWrapper>(), "construction from another brep wrapper");
cls.def(py::init<SolidWrapper>(), "construction from another brep wrapper");
cls.def(py::init<CompoundWrapper>(), "construction from another brep wrapper");
}
}
void registerCompoundWrapper(pybind11::module& module)
{
using Wrapper = OCCUtilities::CompoundWrapper;
using Wrapper = CompoundWrapper;
pybind11::class_<Wrapper> cls(module, "OCCCompoundWrapper");
cls.def(pybind11::init<>());
// functions to add shapes to the compound
using namespace Frackit::Python::OCCUtilities;
cls.def("name", &Wrapper::name, "return the name of the wrapper");
cls.def("add", &Wrapper::add<ShapeWrapper>, "Add a shape to the compound");
cls.def("add", &Wrapper::add<VertexWrapper>, "Add a vertex to the compound");
......@@ -70,7 +70,7 @@ namespace Detail {
}
// convenience function to create wrapper around compound shape
OCCUtilities::CompoundWrapper makeCompound() { return {}; }
CompoundWrapper makeCompoundWrapper() { return {}; }
} // end namespace Detail
......@@ -85,7 +85,7 @@ void registerBRepWrappers(pybind11::module& module)
Detail::registerBRepWrapper<TopoDS_Solid>(module, "OCCSolidWrapper");
Detail::registerCompoundWrapper(module);
module.def("makeCompound", &Detail::makeCompound, "Creates an empty compound to which shapes can be added");
module.def("makeCompoundWrapper", &Detail::makeCompoundWrapper, "Creates an empty compound to which shapes can be added");
}
} // end namespace Frackit::Python
......
......@@ -23,8 +23,8 @@
#include <frackit/geometry/point.hh>
#include <frackit/geometry/segment.hh>
#include <frackit/python/geometry/brepwrapper.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/distance/distance.hh>
namespace Frackit::Python {
......@@ -35,10 +35,7 @@ namespace Detail {
template<class Geo1, class Geo2, class ctype>
ctype computeDistance(const Geo1& geo1, const Geo2& geo2)
{
return Frackit::computeDistance(OCCUtilities::getUnwrappedShape(geo1),
OCCUtilities::getUnwrappedShape(geo2));
}
{ return Frackit::computeDistance(getUnwrappedShape(geo1), getUnwrappedShape(geo2)); }
} // end namespace Detail
......@@ -48,7 +45,7 @@ void registerComputeDistance(py::module& module)
using namespace py::literals;
using Point = Frackit::Point<ctype, 3>;
using Segment = Frackit::Segment<ctype, 3>;
using ShapeWrapper = OCCUtilities::ShapeWrapper;
using ShapeWrapper = Frackit::Python::ShapeWrapper;
module.def("computeDistance",
py::overload_cast<const Point&, const Point&>(&Detail::computeDistance<Point, Point, ctype>),
......
......@@ -27,8 +27,8 @@
#include <frackit/geometry/polygon.hh>
#include <frackit/geometry/cylindersurface.hh>
#include <frackit/geometry/box.hh>
#include <frackit/python/geometry/brepwrapper.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/distance/distancetoboundary.hh>
namespace Frackit::Python {
......@@ -39,10 +39,7 @@ namespace Detail {
template<class Geo1, class Geo2, class ctype>
ctype computeDistanceToBoundary(const Geo1& geo1, const Geo2& geo2)
{
return Frackit::computeDistance(OCCUtilities::getUnwrappedShape(geo1),
OCCUtilities::getUnwrappedShape(geo2));
}
{ return Frackit::computeDistance(getUnwrappedShape(geo1), getUnwrappedShape(geo2)); }
} // end namespace Detail
......@@ -56,9 +53,9 @@ void registerComputeDistanceToBoundary(py::module& module)
using Disk = Frackit::Disk<ctype>;
using CylinderSurface = Frackit::CylinderSurface<ctype>;
using Box = Frackit::Box<ctype>;
using ShapeWrapper = Frackit::Python::OCCUtilities::ShapeWrapper;
using FaceWrapper = Frackit::Python::OCCUtilities::FaceWrapper;
using SolidWrapper = Frackit::Python::OCCUtilities::SolidWrapper;
using ShapeWrapper = Frackit::Python::ShapeWrapper;
using FaceWrapper = Frackit::Python::FaceWrapper;
using SolidWrapper = Frackit::Python::SolidWrapper;
// explicitly implemented overloads
module.def("computeDistanceToBoundary",
......
......@@ -34,8 +34,8 @@
#include <frackit/geometry/quadrilateral.hh>
#include <frackit/geometry/polygon.hh>
#include <frackit/geometry/cylindersurface.hh>
#include <frackit/python/geometry/brepwrapper.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/intersection/intersect.hh>
#include <frackit/intersection/intersectiontraits.hh>
......@@ -47,13 +47,13 @@ namespace Detail {
//! for compatibility with BRepWrapper classes
template<class Geo> struct UnwrapperHelper { using type = Geo; };
template<class Geo> struct UnwrapperHelper<OCCUtilities::BRepWrapper<Geo>> { using type = Geo; };
template<class Geo> struct UnwrapperHelper<BRepWrapper<Geo>> { using type = Geo; };
template<class Geo> using UnwrappedType = typename UnwrapperHelper<Geo>::type;
//! the converted type of an individual geometry type
template<class Geo>
using ConvertedType = std::conditional_t< std::is_convertible_v<Geo, TopoDS_Shape>,
OCCUtilities::BRepWrapper<Geo>,
BRepWrapper<Geo>,
Geo >;
template<class T> struct IsVector : public std::false_type {};
......@@ -88,7 +88,7 @@ using IntersectionResult = ConvertedIntersection<Frackit::Intersection<Unwrapped
//! convert shape into wrapper
template<class Geo, std::enable_if_t<std::is_convertible_v<Geo, TopoDS_Shape>, int> = 0>
OCCUtilities::BRepWrapper<Geo> convertShape(const Geo& geo) { return {geo}; }
BRepWrapper<Geo> convertShape(const Geo& geo) { return {geo}; }
template<class Geo, std::enable_if_t<!std::is_convertible_v<Geo, TopoDS_Shape>, int> = 0>
Geo convertShape(const Geo& geo) { return geo; }
......@@ -127,19 +127,12 @@ IntersectionResult<Geo1, Geo2> intersectAndConvert(const Geo1& geo1, const Geo2&
//! convert shape wrapper function arguments into shape representations and forward
template<class Geo1, class Geo2>
IntersectionResult<Geo1, Geo2> intersect(const Geo1& geo1, const Geo2& geo2)
{
using namespace OCCUtilities;
return intersectAndConvert(getUnwrappedShape(geo1), getUnwrappedShape(geo2));
}
{ return intersectAndConvert(getUnwrappedShape(geo1), getUnwrappedShape(geo2)); }
//! convert shape wrapper function arguments into shape representations and forward
template<class Geo1, class Geo2, class ctype>
IntersectionResult<Geo1, Geo2> intersect(const Geo1& geo1, const Geo2& geo2, ctype eps)
{
using namespace OCCUtilities;
return intersectAndConvert(getUnwrappedShape(geo1), getUnwrappedShape(geo2), eps);
}
{ return intersectAndConvert(getUnwrappedShape(geo1), getUnwrappedShape(geo2), eps); }
template<class Geo1, class Geo2, class ctype>
void registerIntersectionFunction(py::module& module,
......@@ -169,7 +162,7 @@ void registerIntersectionFunctions(py::module& module)
using Polygon = Frackit::Polygon<ctype, 3>;
using Disk = Frackit::Disk<ctype>;
using CylSurf = Frackit::CylinderSurface<ctype>;
using FaceWrapper = Frackit::Python::OCCUtilities::FaceWrapper;
using FaceWrapper = Frackit::Python::FaceWrapper;
Detail::registerIntersectionFunction<Segment, Segment, ctype>(module, "Segment", "Segment");
Detail::registerIntersectionFunction<Quad, Quad, ctype>(module, "Quadrilateral", "Quadrilateral");
......
......@@ -28,7 +28,7 @@
#include <frackit/geometry/quadrilateral.hh>
#include <frackit/geometry/box.hh>
#include <frackit/geometry/cylinder.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/python/geometry/brepwrapper.hh>
#include <frackit/python/common/extractctype.hh>
#include <frackit/magnitude/magnitude.hh>
......@@ -44,30 +44,13 @@ namespace Detail {
template<class Geo, class Domain>
typename CoordinateTypeTraits<Geo>::type
computeContainedMagnitude(const Geo& geo, const Domain& domain)
{
static constexpr bool isWrapperGeo = OCCUtilities::IsBRepWrapper<Geo>::value;
static constexpr bool isWrapperDomain = OCCUtilities::IsBRepWrapper<Domain>::value;
if constexpr (isWrapperGeo && isWrapperDomain)
return Frackit::computeContainedMagnitude(geo.get(), domain.get());
else if constexpr (isWrapperGeo && !isWrapperDomain)
return Frackit::computeContainedMagnitude(geo.get(), domain);
else if constexpr (!isWrapperGeo && isWrapperDomain)
return Frackit::computeContainedMagnitude(geo, domain.get());
else
return Frackit::computeContainedMagnitude(geo, domain);
}
{ return Frackit::computeContainedMagnitude(getUnwrappedShape(geo), getUnwrappedShape(domain)); }
//! overload for computation of the magnitude of the contained part of a shape wrapper
template<class Geo>
typename CoordinateTypeTraits<Geo>::type
computeMagnitude(const Geo& geo)
{
if constexpr (OCCUtilities::IsBRepWrapper<Geo>::value)
return Frackit::computeMagnitude(geo.get());
else
return Frackit::computeMagnitude(geo);
}
{ return Frackit::computeMagnitude(getUnwrappedShape(geo)); }
template<class Geo>
void registerMagnitude(py::module& module)
......@@ -91,7 +74,6 @@ template<class ctype>
void registerMagnitude(py::module& module)
{
using namespace Frackit;
using namespace Frackit::Python::OCCUtilities;
Detail::registerMagnitude< Segment<ctype, 3> >(module);
Detail::registerMagnitude< Disk<ctype> >(module);
Detail::registerMagnitude< Quadrilateral<ctype, 3> >(module);
......@@ -104,7 +86,6 @@ template<class ctype>
void registerContainedMagnitude(py::module& module)
{
using namespace Frackit;
using namespace Frackit::Python::OCCUtilities;
Detail::registerContainedMagnitude< Segment<ctype, 3>, Box<ctype> >(module);
Detail::registerContainedMagnitude< Segment<ctype, 3>, Cylinder<ctype> >(module);
Detail::registerContainedMagnitude< Segment<ctype, 3>, SolidWrapper >(module);
......
install(FILES
breputilities.hh
brepwrapper.hh
brepwrappers.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/frackit/python/occutilities)
......@@ -41,13 +41,12 @@
#include <frackit/geometry/cylinder.hh>
#include <frackit/geometry/cylindersurface.hh>
#include <frackit/geometry/sphere.hh>
#include <frackit/python/geometry/brepwrapper.hh>
#include <frackit/occ/breputilities.hh>
#include <frackit/occ/gputilities.hh>
#include <frackit/occ/geomutilities.hh>
#include "brepwrapper.hh"
namespace Frackit::Python {
namespace Detail {
......@@ -338,10 +337,10 @@ void registerBRepUtilities(pybind11::module& module)
module.def("getShape", &OCCUtilities::getShape<Sphere<ctype>>, "Returns the OCC BRep of a sphere");
// register "shape conversions" also for wrapped shapes
Detail::registerWrappedShapeConversions<OCCUtilities::ShapeWrapper, OCCUtilities::VertexWrapper,
OCCUtilities::EdgeWrapper, OCCUtilities::WireWrapper,
OCCUtilities::FaceWrapper, OCCUtilities::ShellWrapper,
OCCUtilities::SolidWrapper, OCCUtilities::CompoundWrapper>(module);
Detail::registerWrappedShapeConversions<ShapeWrapper, VertexWrapper,
EdgeWrapper, WireWrapper,
FaceWrapper, ShellWrapper,
SolidWrapper, CompoundWrapper>(module);
// register getter functions for (sub-)shapes of a wrapped shape
Detail::registerSubShapeGetterFunctions(module);
......@@ -350,7 +349,7 @@ void registerBRepUtilities(pybind11::module& module)
module.def("readShape", &OCCUtilities::readShape, "Reads in the shapes from a file");
// register bounding box computations for wrapped shape
module.def("getBoundingBox", &OCCUtilities::getBoundingBox<OCCUtilities::ShapeWrapper, ctype>, "returns the bounding box of a wrapped shape");
module.def("getBoundingBox", &OCCUtilities::getBoundingBox<ShapeWrapper, ctype>, "returns the bounding box of a wrapped shape");
// register transformations (we could use recurring templates as for registerWrappedShapeConversions)
module.def("translate", &OCCUtilities::translate<TopoDS_Shape, ctype, 3>, "translation of a shape with a vector defined in 3d space");
......@@ -365,30 +364,30 @@ void registerBRepUtilities(pybind11::module& module)
// register boolean operations for shape wrapper
using namespace py::literals;
module.def("cut",
&OCCUtilities::cut<OCCUtilities::ShapeWrapper, OCCUtilities::ShapeWrapper, ctype>,
&OCCUtilities::cut<ShapeWrapper, ShapeWrapper, ctype>,
"object"_a, "tool"_a, "tolerance"_a,
"cuts the tool from the object");
using namespace py::literals;
module.def("intersect",
&OCCUtilities::intersect<OCCUtilities::ShapeWrapper, OCCUtilities::ShapeWrapper, ctype>,
&OCCUtilities::intersect<ShapeWrapper, ShapeWrapper, ctype>,
"object1"_a, "object2"_a, "tolerance"_a,
"returns the common part (intersection) between the two given shapes");
using namespace py::literals;
module.def("fragment",
&OCCUtilities::fragment<OCCUtilities::ShapeWrapper, ctype>,
&OCCUtilities::fragment<ShapeWrapper, ctype>,
"objects"_a, "tolerance"_a,
"returns the fragments after intersection of the all given shapes");
using namespace py::literals;
module.def("fuse",
&OCCUtilities::fuse<OCCUtilities::ShapeWrapper, ctype>,
&OCCUtilities::fuse<ShapeWrapper, ctype>,
"objects"_a, "tolerance"_a,
"fuse all given shapes into a single one");
// register write function for wrapped shapes
module.def("write", &OCCUtilities::write<OCCUtilities::ShapeWrapper>, "writes a wrapped shape to a BRep file");
module.def("write", &OCCUtilities::write<ShapeWrapper>, "writes a wrapped shape to a BRep file");
}
} // end namespace Frackit::Python
......
......@@ -29,7 +29,7 @@
#include <frackit/geometry/quadrilateral.hh>
#include <frackit/geometry/cylindersurface.hh>
#include <frackit/geometry/box.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/python/geometry/brepwrapper.hh>
#include <frackit/python/common/extractctype.hh>
#include <frackit/precision/defaultepsilon.hh>
......@@ -43,12 +43,7 @@ namespace Detail {
template<class Geo>
typename CoordinateTypeTraits<Geo>::type
defaultEpsilon(const Geo& geo)
{
if constexpr(OCCUtilities::IsBRepWrapper<Geo>::value)
return Frackit::defaultEpsilon(geo.get());
else
return Frackit::defaultEpsilon(geo);
}
{ return Frackit::defaultEpsilon(getUnwrappedShape(geo)); }