-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update to flow fields * Formatting changes * Add cpp files for Parabolic and Constant flow class * Revise parabolic flow coordinate system * Fix pybind11 visbility --------- Co-authored-by: Michael Howard <[email protected]>
- Loading branch information
Showing
12 changed files
with
389 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2018-2020, Michael P. Howard | ||
// Copyright (c) 2021-2024, Auburn University | ||
// Part of azplugins, released under the BSD 3-Clause License. | ||
|
||
#include "ConstantFlow.h" | ||
|
||
namespace hoomd | ||
{ | ||
namespace azplugins | ||
{ | ||
namespace detail | ||
{ | ||
void export_ConstantFlow(pybind11::module& m) | ||
{ | ||
namespace py = pybind11; | ||
py::class_<ConstantFlow, std::shared_ptr<ConstantFlow>>(m, "ConstantFlow") | ||
.def(py::init<Scalar3>()) | ||
.def_property( | ||
"velocity", | ||
[](const ConstantFlow& U) | ||
{ | ||
const auto field = U.getVelocity(); | ||
return pybind11::make_tuple(field.x, field.y, field.z); | ||
}, | ||
[](ConstantFlow& U, const pybind11::tuple& field) | ||
{ | ||
U.setVelocity(make_scalar3(pybind11::cast<Scalar>(field[0]), | ||
pybind11::cast<Scalar>(field[1]), | ||
pybind11::cast<Scalar>(field[2]))); | ||
}); | ||
} | ||
} // end namespace detail | ||
} // end namespace azplugins | ||
} // end namespace hoomd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright (c) 2018-2020, Michael P. Howard | ||
// Copyright (c) 2021-2024, Auburn University | ||
// Part of azplugins, released under the BSD 3-Clause License. | ||
|
||
#ifndef AZPLUGINS_CONSTANT_FLOW_H_ | ||
#define AZPLUGINS_CONSTANT_FLOW_H_ | ||
|
||
#ifndef __HIPCC__ | ||
#include <pybind11/pybind11.h> | ||
#endif | ||
|
||
#include "hoomd/HOOMDMath.h" | ||
|
||
#ifndef __HIPCC__ | ||
#define HOSTDEVICE __host__ __device__ | ||
#else | ||
#define HOSTDEVICE | ||
#endif // __HIPCC__ | ||
|
||
#ifndef PYBIND11_EXPORT | ||
#define PYBIND11_EXPORT __attribute__((visibility("default"))) | ||
#endif | ||
|
||
namespace hoomd | ||
{ | ||
namespace azplugins | ||
{ | ||
|
||
//! Position-independent flow along a vector | ||
class PYBIND11_EXPORT ConstantFlow | ||
{ | ||
public: | ||
//! Constructor | ||
/*! | ||
*\param U_ Flow field | ||
*/ | ||
ConstantFlow(Scalar3 velocity) | ||
{ | ||
setVelocity(velocity); | ||
} | ||
|
||
//! Evaluate the flow field | ||
/*! | ||
* \param r position to evaluate flow | ||
* | ||
* This is just a constant, independent of \a r. | ||
*/ | ||
HOSTDEVICE Scalar3 operator()(const Scalar3& r) const | ||
{ | ||
return U; | ||
} | ||
|
||
HOSTDEVICE Scalar3 getVelocity() const | ||
{ | ||
return U; | ||
} | ||
|
||
HOSTDEVICE void setVelocity(const Scalar3& U_) | ||
{ | ||
U = U_; | ||
} | ||
|
||
private: | ||
Scalar3 U; //!< Flow field | ||
}; | ||
|
||
} // namespace azplugins | ||
} // namespace hoomd | ||
|
||
#undef HOSTDEVICE | ||
#undef PYBIND11_EXPORT | ||
|
||
#endif // AZPLUGINS_CONSTANT_FLOW_H_ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2018-2020, Michael P. Howard | ||
// Copyright (c) 2021-2024, Auburn University | ||
// Part of azplugins, released under the BSD 3-Clause License. | ||
|
||
#include "ParabolicFlow.h" | ||
|
||
namespace hoomd | ||
{ | ||
namespace azplugins | ||
{ | ||
namespace detail | ||
{ | ||
void export_ParabolicFlow(pybind11::module& m) | ||
{ | ||
namespace py = pybind11; | ||
py::class_<ParabolicFlow, std::shared_ptr<ParabolicFlow>>(m, "ParabolicFlow") | ||
.def(py::init<Scalar, Scalar>()) | ||
.def_property("mean_velocity", | ||
&ParabolicFlow::getMeanVelocity, | ||
&ParabolicFlow::setMeanVelocity) | ||
.def_property("separation", &ParabolicFlow::getSeparation, &ParabolicFlow::setSeparation); | ||
} | ||
} // namespace detail | ||
} // namespace azplugins | ||
} // namespace hoomd |
Oops, something went wrong.