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
7fd65a49
Commit
7fd65a49
authored
May 25, 2020
by
Dennis Gläser
Browse files
[python][sampling] add status class
parent
3bc52cc1
Changes
3
Hide whitespace changes
Inline
Side-by-side
frackit/python/sampling/CMakeLists.txt
View file @
7fd65a49
...
...
@@ -2,4 +2,5 @@ install(FILES
boxpointsampler.hh
cylinderpointsampler.hh
pointsampler.hh
status.hh
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/frackit/python/sampling
)
frackit/python/sampling/status.hh
0 → 100644
View file @
7fd65a49
// -*- 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_SAMPLING_STATUS_HH
#define FRACKIT_PYTHON_SAMPLING_STATUS_HH
#include
<pybind11/pybind11.h>
#include
<frackit/common/id.hh>
#include
<frackit/sampling/status.hh>
namespace
Frackit
::
Python
{
namespace
py
=
pybind11
;
void
registerSamplingStatus
(
py
::
module
&
module
)
{
py
::
class_
<
SamplingStatus
>
cls
(
module
,
"SamplingStatus"
);
cls
.
def
(
py
::
init
());
cls
.
def
(
"setTargetCount"
,
&
SamplingStatus
::
setTargetCount
,
"Define the target number of samples for the given id"
);
cls
.
def
(
"finished"
,
py
::
overload_cast
<>
(
&
SamplingStatus
::
finished
),
"Returns true if overall target sample count is reached"
);
cls
.
def
(
"finished"
,
py
::
overload_cast
<
const
Id
&>
(
&
SamplingStatus
::
finished
),
"Returns true if the sample count for the given id is reached"
);
cls
.
def
(
"increaseCounter"
,
&
SamplingStatus
::
increaseCounter
,
"Register that a new sample for the given id was taken"
);
cls
.
def
(
"increaseRejectedCounter"
,
&
SamplingStatus
::
increaseRejectedCounter
,
"Register that a sample has been rejected"
);
using
namespace
py
::
literals
;
cls
.
def
(
"print"
,
&
SamplingStatus
::
print
,
"forceHeaderPrint"
_a
=
false
,
"Print the current status"
);
}
}
// end namespace Frackit::Python
#endif
python/frackit/sampling/_sampling.cc
View file @
7fd65a49
...
...
@@ -23,6 +23,7 @@
#include
<frackit/geometry/hollowcylinder.hh>
#include
<frackit/sampling/makeuniformpointsampler.hh>
#include
<frackit/python/sampling/status.hh>
#include
<frackit/python/sampling/pointsampler.hh>
#include
<frackit/python/sampling/boxpointsampler.hh>
#include
<frackit/python/sampling/cylinderpointsampler.hh>
...
...
@@ -60,6 +61,9 @@ void registerPointSamplerCreatorFunctions(pybind11::module& module)
PYBIND11_MODULE
(
_sampling
,
module
)
{
// register status class
Frackit
::
Python
::
registerSamplingStatus
(
module
);
// register base class for all dimensions
Frackit
::
Python
::
registerPointSamplerInterface
<
double
,
1
>
(
module
);
Frackit
::
Python
::
registerPointSamplerInterface
<
double
,
2
>
(
module
);
...
...
Write
Preview
Supports
Markdown
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