-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add placeholder for the 2/3D Euler CESE solver #403
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (c) 2019, Yung-Yu Chen <[email protected]> | ||
# BSD-style license; see COPYING | ||
|
||
cmake_minimum_required(VERSION 3.16) | ||
|
||
set(MODMESH_MULTIDIM_HEADERS | ||
${CMAKE_CURRENT_SOURCE_DIR}/multidim.hpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/euler.hpp | ||
CACHE FILEPATH "" FORCE) | ||
|
||
set(MODMESH_MULTIDIM_SOURCES | ||
CACHE FILEPATH "" FORCE) | ||
|
||
set(MODMESH_MULTIDIM_PYMODHEADERS | ||
${CMAKE_CURRENT_SOURCE_DIR}/pymod/multidim_pymod.hpp | ||
CACHE FILEPATH "" FORCE) | ||
|
||
set(MODMESH_MULTIDIM_PYMODSOURCES | ||
${CMAKE_CURRENT_SOURCE_DIR}/pymod/multidim_pymod.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/pymod/wrap_multidim.cpp | ||
CACHE FILEPATH "" FORCE) | ||
|
||
set(MODMESH_MULTIDIM_FILES | ||
${MODMESH_MULTIDIM_HEADERS} | ||
${MODMESH_MULTIDIM_SOURCES} | ||
${MODMESH_MULTIDIM_PYMODHEADERS} | ||
${MODMESH_MULTIDIM_PYMODSOURCES} | ||
CACHE FILEPATH "" FORCE) | ||
|
||
# vim: set ff=unix fenc=utf8 nobomb et sw=4 ts=4 sts=4: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#pragma once | ||
|
||
/* | ||
* Copyright (c) 2024, Yung-Yu Chen <[email protected]> | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the copyright holder nor the names of its contributors | ||
* may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
/** | ||
* The space-time CESE solver for the Euler equation. | ||
*/ | ||
|
||
#include <modmesh/mesh/mesh.hpp> | ||
|
||
namespace modmesh | ||
{ | ||
|
||
class EulerCore | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The solver core for the Euler equation. I hope there is a better name than core, but I haven't got one. I will wait a while before adding code comment block. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Core" sounds fine, unless you have other Euler stuff. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My concern is that |
||
: public NumberBase<int32_t, double> | ||
, public std::enable_shared_from_this<EulerCore> | ||
{ | ||
|
||
private: | ||
|
||
class ctor_passkey | ||
{ | ||
}; | ||
|
||
public: | ||
|
||
using number_base = NumberBase<int32_t, double>; | ||
using int_type = typename number_base::int_type; | ||
using uint_type = typename number_base::uint_type; | ||
using real_type = typename number_base::real_type; | ||
|
||
template <typename... Args> | ||
static std::shared_ptr<EulerCore> construct(Args &&... args) | ||
{ | ||
return std::make_shared<EulerCore>(std::forward<Args>(args)..., ctor_passkey()); | ||
} | ||
|
||
EulerCore(std::shared_ptr<StaticMesh> const & mesh, real_type time_increment, ctor_passkey const &) | ||
: m_mesh(mesh) | ||
, m_time_increment(time_increment) | ||
{ | ||
} | ||
|
||
EulerCore() = delete; | ||
EulerCore(EulerCore const &) = delete; | ||
EulerCore(EulerCore &&) = delete; | ||
EulerCore operator=(EulerCore const &) = delete; | ||
EulerCore operator=(EulerCore &&) = delete; | ||
~EulerCore() = default; | ||
|
||
private: | ||
|
||
std::shared_ptr<StaticMesh> m_mesh; | ||
real_type m_time_increment = 0.0; | ||
|
||
}; /* end class EulerCore */ | ||
|
||
} /* end namespace modmesh */ | ||
|
||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Placeholder header for the new |
||
|
||
/* | ||
* Copyright (c) 2024, Yung-Yu Chen <[email protected]> | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the copyright holder nor the names of its contributors | ||
* may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
/** | ||
* Multi-dimensional space-time CESE solver. | ||
*/ | ||
|
||
#include <modmesh/mesh/mesh.hpp> | ||
#include <modmesh/multidim/euler.hpp> | ||
|
||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) 2024, Yung-Yu Chen <[email protected]> | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the copyright holder nor the names of its contributors | ||
* may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <modmesh/multidim/pymod/multidim_pymod.hpp> // Must be the first include for Python. | ||
#include <pybind11/stl.h> | ||
|
||
#include <modmesh/modmesh.hpp> | ||
#include <modmesh/python/common.hpp> | ||
|
||
namespace modmesh | ||
{ | ||
|
||
namespace python | ||
{ | ||
|
||
struct multidim_pymod_tag | ||
{ | ||
}; | ||
|
||
template <> | ||
OneTimeInitializer<multidim_pymod_tag> & OneTimeInitializer<multidim_pymod_tag>::me() | ||
{ | ||
static OneTimeInitializer<multidim_pymod_tag> instance; | ||
return instance; | ||
} | ||
|
||
void initialize_multidim(pybind11::module & mod) | ||
{ | ||
auto initialize_impl = [](pybind11::module & mod) | ||
{ | ||
wrap_multidim(mod); | ||
}; | ||
|
||
OneTimeInitializer<multidim_pymod_tag>::me()(mod, initialize_impl); | ||
} | ||
|
||
} /* end namespace python */ | ||
|
||
} /* end namespace modmesh */ | ||
|
||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#pragma once | ||
|
||
/* | ||
* Copyright (c) 2024, Yung-Yu Chen <[email protected]> | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the copyright holder nor the names of its contributors | ||
* may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <modmesh/python/python.hpp> // Must be the first include. | ||
#include <pybind11/stl.h> | ||
|
||
#include <modmesh/modmesh.hpp> | ||
#include <modmesh/python/common.hpp> | ||
|
||
namespace modmesh | ||
{ | ||
|
||
namespace python | ||
{ | ||
|
||
void initialize_multidim(pybind11::module & mod); | ||
void wrap_multidim(pybind11::module & mod); | ||
|
||
} /* end namespace python */ | ||
|
||
} /* end namespace modmesh */ | ||
|
||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright (c) 2024, Yung-Yu Chen <[email protected]> | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the copyright holder nor the names of its contributors | ||
* may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <modmesh/python/common.hpp> // Must be the first include. | ||
|
||
#include <modmesh/multidim/multidim.hpp> | ||
|
||
namespace modmesh | ||
{ | ||
|
||
namespace python | ||
{ | ||
|
||
using namespace modmesh; // NOLINT(google-build-using-namespace) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't. Thanks for spotting it. It will be fixed in the next upload. |
||
|
||
class MODMESH_PYTHON_WRAPPER_VISIBILITY WrapEulerCore | ||
: public WrapBase<WrapEulerCore, EulerCore, std::shared_ptr<EulerCore>> | ||
{ | ||
|
||
public: | ||
|
||
using base_type = WrapBase<WrapEulerCore, EulerCore, std::shared_ptr<EulerCore>>; | ||
using wrapper_type = typename base_type::wrapper_type; | ||
using wrapped_type = typename base_type::wrapped_type; | ||
|
||
friend base_type; | ||
|
||
protected: | ||
|
||
WrapEulerCore(pybind11::module & mod, const char * pyname, const char * clsdoc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the placeholding C++ class available in Python. |
||
: base_type(mod, pyname, clsdoc) | ||
{ | ||
|
||
namespace py = pybind11; | ||
|
||
(*this) | ||
.def( | ||
py::init( | ||
[](std::shared_ptr<StaticMesh> const & mesh, wrapped_type::real_type time_increment) | ||
{ | ||
return wrapped_type::construct(mesh, time_increment); | ||
}), | ||
py::arg("mesh"), | ||
py::arg("time_increment")); | ||
} | ||
|
||
}; /* end class WrapEulerCore */ | ||
|
||
void wrap_multidim(pybind11::module & mod) | ||
{ | ||
WrapEulerCore::commit(mod, "EulerCore", "Solve the Euler equation"); | ||
} | ||
|
||
} /* end namespace python */ | ||
|
||
} /* end namespace modmesh */ | ||
|
||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
#include <modmesh/inout/pymod/inout_pymod.hpp> | ||
#include <modmesh/mesh/pymod/mesh_pymod.hpp> | ||
#include <modmesh/onedim/pymod/onedim_pymod.hpp> | ||
#include <modmesh/multidim/pymod/multidim_pymod.hpp> | ||
#include <modmesh/python/module.hpp> | ||
#include <modmesh/spacetime/pymod/spacetime_pymod.hpp> | ||
#include <modmesh/toggle/pymod/toggle_pymod.hpp> | ||
|
@@ -48,6 +49,7 @@ void initialize(pybind11::module_ mod) | |
initialize_buffer(mod); | ||
initialize_universe(mod); | ||
initialize_mesh(mod); | ||
initialize_multidim(mod); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add code in the |
||
initialize_inout(mod); | ||
pybind11::module_ spacetime_mod = mod.def_submodule("spacetime", "spacetime"); | ||
initialize_spacetime(spacetime_mod); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to be 2024.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The year remained in the past because the content was almost identical to the original file it copied from.