Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tools
frackit
Commits
36e4e659
Commit
36e4e659
authored
May 26, 2020
by
Dennis Gläser
Browse files
[python] provide ctype traits compatible with brep wrappers
parent
4416a527
Changes
3
Hide whitespace changes
Inline
Side-by-side
frackit/python/common/CMakeLists.txt
View file @
36e4e659
install
(
FILES
extractctype.hh
id.hh
math.hh
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/frackit/python/common
)
frackit/python/common/extractctype.hh
0 → 100644
View file @
36e4e659
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* 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_EXTRACT_CTYPE_HH
#define FRACKIT_PYTHON_EXTRACT_CTYPE_HH
#include <frackit/common/extractctype.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
namespace
Frackit
::
Python
{
// helper struct to extract the underlying coordinate type of a
// geometry that provides compatibility with the brep wrappers
template
<
class
Geo
>
struct
CoordinateTypeTraits
:
public
Frackit
::
CoordinateTypeTraits
<
Geo
>
{};
template
<
class
S
>
struct
CoordinateTypeTraits
<
OCCUtilities
::
BRepWrapper
<
S
>>
:
public
Frackit
::
CoordinateTypeTraits
<
S
>
{};
}
// end namespace Frackit::Python
#endif
frackit/python/magnitude/magnitude.hh
View file @
36e4e659
...
...
@@ -21,7 +21,6 @@
#include <pybind11/pybind11.h>
#include <frackit/common/extractctype.hh>
// supported (registered) geometry types (so far)
#include <frackit/geometry/disk.hh>
...
...
@@ -30,6 +29,7 @@
#include <frackit/geometry/box.hh>
#include <frackit/geometry/cylinder.hh>
#include <frackit/python/occutilities/brepwrapper.hh>
#include <frackit/python/common/extractctype.hh>
#include <frackit/magnitude/magnitude.hh>
#include <frackit/magnitude/containedmagnitude.hh>
...
...
@@ -40,16 +40,9 @@ namespace py = pybind11;
namespace
Detail
{
// helper struct for ctype traits to achieve support for brepwrappers
template
<
class
Geo
>
struct
CTypeTraits
:
public
Frackit
::
CoordinateTypeTraits
<
Geo
>
{};
template
<
class
S
>
struct
CTypeTraits
<
OCCUtilities
::
BRepWrapper
<
S
>>
:
public
Frackit
::
CoordinateTypeTraits
<
S
>
{};
//! overload for computation of the magnitude of the contained part of a shape wrapper
template
<
class
Geo
,
class
Domain
>
typename
CTypeTraits
<
Geo
>::
type
typename
C
oordinate
TypeTraits
<
Geo
>::
type
computeContainedMagnitude
(
const
Geo
&
geo
,
const
Domain
&
domain
)
{
static
constexpr
bool
isWrapperGeo
=
OCCUtilities
::
IsBRepWrapper
<
Geo
>::
value
;
...
...
@@ -67,7 +60,7 @@ namespace Detail {
//! overload for computation of the magnitude of the contained part of a shape wrapper
template
<
class
Geo
>
typename
CTypeTraits
<
Geo
>::
type
typename
C
oordinate
TypeTraits
<
Geo
>::
type
computeMagnitude
(
const
Geo
&
geo
)
{
if
constexpr
(
OCCUtilities
::
IsBRepWrapper
<
Geo
>::
value
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment