Skip to content
Snippets Groups Projects
Commit 3dfd80ea authored by wenqing's avatar wenqing Committed by Dmitri Naumov
Browse files

[Process] Moved BoudaryCondition and SourceTerms to one directory.

parent 8278941d
No related branches found
No related tags found
No related merge requests found
Showing
with 54 additions and 53 deletions
......@@ -34,8 +34,7 @@ if(OGS_USE_PYTHON)
# this is up to you). TODO: Enable further compiler/linker flags.
target_link_libraries(
ogs_embedded_python PUBLIC pybind11::embed
PRIVATE ProcessLibBoundaryConditionPythonModule
ProcessLibSourceTermPythonModule
PRIVATE ProcessLibBoundaryConditionAndSourceTermPythonModule
)
target_compile_definitions(
ogs_embedded_python
......
......@@ -12,9 +12,9 @@
#include <pybind11/embed.h>
#include "BaseLib/Logging.h"
#include "ProcessLib/BoundaryCondition/Python/BHEInflowPythonBoundaryConditionModule.h"
#include "ProcessLib/BoundaryCondition/Python/PythonBoundaryConditionModule.h"
#include "ProcessLib/SourceTerms/Python/PythonSourceTermModule.h"
#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/BHEInflowPythonBoundaryConditionModule.h"
#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/PythonBoundaryConditionModule.h"
#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/PythonSourceTermModule.h"
PYBIND11_EMBEDDED_MODULE(OpenGeoSys, m)
{
......
......@@ -22,7 +22,7 @@ namespace NumLib
class LocalToGlobalIndexMap;
template <typename>
struct IndexValueVector;
}
} // namespace NumLib
namespace ParameterLib
{
struct ParameterBase;
......
......@@ -10,11 +10,10 @@
#pragma once
#include "BoundaryCondition.h"
#include "NumLib/IndexValueVector.h"
#include "ProcessLib/ProcessVariable.h"
#include "BoundaryCondition.h"
namespace ProcessLib
{
class BoundaryConditionCollection final
......@@ -35,7 +34,8 @@ public:
getKnownSolutions(double const t, GlobalVector const& x) const
{
auto const n_bcs = _boundary_conditions.size();
for (std::size_t i=0; i<n_bcs; ++i) {
for (std::size_t i = 0; i < n_bcs; ++i)
{
auto const& bc = *_boundary_conditions[i];
auto& dirichlet_storage = _dirichlet_bcs[i];
bc.getEssentialBCValues(t, x, dirichlet_storage);
......@@ -73,7 +73,8 @@ public:
}
private:
mutable std::vector<NumLib::IndexValueVector<GlobalIndexType>> _dirichlet_bcs;
mutable std::vector<NumLib::IndexValueVector<GlobalIndexType>>
_dirichlet_bcs;
std::vector<std::unique_ptr<BoundaryCondition>> _boundary_conditions;
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const&
_parameters;
......
......@@ -17,7 +17,7 @@
#include "MeshLib/MeshSearch/NodeSearch.h" // for getUniqueNodes
#include "MeshLib/Node.h"
#include "ParameterLib/Utils.h"
#include "ProcessLib/Utils/ForBoundaryConditionOrSourceTerm/CreateLocalAssemblers.h"
#include "ProcessLib/BoundaryConditionAndSourceTerm/Utils/CreateLocalAssemblers.h"
namespace ProcessLib
{
......@@ -78,8 +78,9 @@ ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition(
"bulk_node_ids", MeshLib::MeshItemType::Node, 1);
auto const& bulk_nodes = bulk_mesh.getNodes();
auto get_bulk_element_face_id = [&](auto const bulk_element_id,
MeshLib::Element const* bc_elem) {
auto get_bulk_element_face_id =
[&](auto const bulk_element_id, MeshLib::Element const* bc_elem)
{
auto const* bulk_elem = _bulk_mesh.getElement(bulk_element_id);
std::array<MeshLib::Node*, 3> nodes{
{bulk_nodes[(*bulk_node_ids)[bc_elem->getNode(0)->getID()]],
......@@ -89,18 +90,20 @@ ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition(
};
_bulk_ids.reserve(bc_elements.size());
std::transform(begin(bc_elements), end(bc_elements),
std::back_inserter(_bulk_ids), [&](auto const* bc_element) {
auto const bulk_element_id =
(*bulk_element_ids)[bc_element->getID()];
return std::make_pair(bulk_element_id,
get_bulk_element_face_id(
bulk_element_id, bc_element));
});
std::transform(
begin(bc_elements), end(bc_elements), std::back_inserter(_bulk_ids),
[&](auto const* bc_element)
{
auto const bulk_element_id =
(*bulk_element_ids)[bc_element->getID()];
return std::make_pair(
bulk_element_id,
get_bulk_element_face_id(bulk_element_id, bc_element));
});
const int shape_function_order = 1;
BoundaryConditionOrSourceTerm::createLocalAssemblers<
BoundaryConditionAndSourceTerm::createLocalAssemblers<
ConstraintDirichletBoundaryConditionLocalAssembler>(
_bulk_mesh.getDimension(), _bc_mesh.getElements(), *_dof_table_boundary,
shape_function_order, _local_assemblers, _bc_mesh.isAxiallySymmetric(),
......@@ -121,9 +124,8 @@ void ConstraintDirichletBoundaryCondition::preTimestep(
x, t,
[this](std::size_t const element_id,
MathLib::Point3d const& pnt, double const t,
std::vector<GlobalVector*> const& x) {
return _getFlux(element_id, pnt, t, x);
});
std::vector<GlobalVector*> const& x)
{ return _getFlux(element_id, pnt, t, x); });
}
}
......@@ -138,7 +140,8 @@ void ConstraintDirichletBoundaryCondition::getEssentialBCValues(
std::vector<std::pair<GlobalIndexType, double>> tmp_bc_values;
auto isFlux = [&](const std::size_t element_id) {
auto isFlux = [&](const std::size_t element_id)
{
return _lower ? _flux_values[element_id] < _constraint_threshold
: _flux_values[element_id] > _constraint_threshold;
};
......@@ -193,9 +196,8 @@ void ConstraintDirichletBoundaryCondition::getEssentialBCValues(
// first: sort the (node id, value) pairs according to the node id
std::sort(tmp_bc_values.begin(), tmp_bc_values.end(),
[](std::pair<GlobalIndexType, double> const& a,
std::pair<GlobalIndexType, double> const& b) {
return a.first < b.first;
});
std::pair<GlobalIndexType, double> const& b)
{ return a.first < b.first; });
// second: average the values over equal node id ranges
unsigned cnt = 1;
GlobalIndexType current_id = tmp_bc_values.begin()->first;
......@@ -259,11 +261,10 @@ createConstraintDirichletBoundaryCondition(
const int process_id = 0;
auto process_variables =
constraining_process.getProcessVariables(process_id);
auto constraining_pv = std::find_if(
process_variables.cbegin(), process_variables.cend(),
[&constraining_process_variable](ProcessVariable const& pv) {
return pv.getName() == constraining_process_variable;
});
auto constraining_pv =
std::find_if(process_variables.cbegin(), process_variables.cend(),
[&constraining_process_variable](ProcessVariable const& pv)
{ return pv.getName() == constraining_process_variable; });
if (constraining_pv == std::end(process_variables))
{
auto const& constraining_process_variable_name =
......@@ -320,9 +321,8 @@ createConstraintDirichletBoundaryCondition(
lower,
[&constraining_process](std::size_t const element_id,
MathLib::Point3d const& pnt, double const t,
std::vector<GlobalVector*> const& x) {
return constraining_process.getFlux(element_id, pnt, t, x);
});
std::vector<GlobalVector*> const& x)
{ return constraining_process.getFlux(element_id, pnt, t, x); });
}
} // namespace ProcessLib
......@@ -11,12 +11,11 @@
#pragma once
#include "BoundaryCondition.h"
#include "ConstraintDirichletBoundaryConditionLocalAssembler.h"
#include "NumLib/DOF/LocalToGlobalIndexMap.h"
#include "NumLib/IndexValueVector.h"
#include "ParameterLib/Parameter.h"
#include "ConstraintDirichletBoundaryConditionLocalAssembler.h"
namespace ProcessLib
{
/// The ConstraintDirichletBoundaryCondition class describes a Dirichlet-type
......
......@@ -21,7 +21,6 @@
namespace ProcessLib
{
struct IntegrationPointData final
{
IntegrationPointData(double const& detJ,
......@@ -72,9 +71,8 @@ public:
/// @param bulk_ids Pairs of bulk element ids and bulk element face ids.
ConstraintDirichletBoundaryConditionLocalAssembler(
MeshLib::Element const& surface_element,
std::size_t /* local_matrix_size */,
bool const is_axially_symmetric, unsigned const integration_order,
MeshLib::Mesh const& bulk_mesh,
std::size_t /* local_matrix_size */, bool const is_axially_symmetric,
unsigned const integration_order, MeshLib::Mesh const& bulk_mesh,
std::vector<std::pair<std::size_t, unsigned>> bulk_ids)
: _surface_element(surface_element),
_integration_method(integration_order),
......
......@@ -43,4 +43,4 @@ std::unique_ptr<SourceTerm> createNodalSourceTerm(
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const&
parameters);
} // namespace ProcessLib
} // namespace ProcessLib
......@@ -10,8 +10,8 @@
#pragma once
#include <vector>
#include <memory>
#include <vector>
#include "ParameterLib/Parameter.h"
......
......@@ -44,4 +44,4 @@ std::unique_ptr<SourceTerm> createVolumetricSourceTerm(
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
unsigned const integration_order, unsigned const shapefunction_order);
} // namespace ProcessLib
} // namespace ProcessLib
......@@ -60,16 +60,18 @@ void DeactivatedSubdomainDirichlet::getEssentialBCValues(
.template getPropertyVector<std::size_t>(
"bulk_element_ids", MeshLib::MeshItemType::Cell, 1);
auto is_inactive = [&](MeshLib::Element const* const e) {
return none_of(
begin(*_active_element_ids), end(*_active_element_ids),
[&](auto const id) { return id == bulk_element_ids[e->getID()]; });
auto is_inactive = [&](MeshLib::Element const* const e)
{
return none_of(begin(*_active_element_ids), end(*_active_element_ids),
[&](auto const id)
{ return id == bulk_element_ids[e->getID()]; });
};
std::vector<MeshLib::Node*> inactive_nodes_in_bc_mesh;
std::copy_if(begin(_subdomain.inner_nodes), end(_subdomain.inner_nodes),
back_inserter(inactive_nodes_in_bc_mesh),
[&](MeshLib::Node* const n) {
[&](MeshLib::Node* const n)
{
const auto& connected_elements = n->getElements();
return std::all_of(begin(connected_elements),
......@@ -80,7 +82,8 @@ void DeactivatedSubdomainDirichlet::getEssentialBCValues(
{
std::copy_if(begin(_subdomain.outer_nodes), end(_subdomain.outer_nodes),
back_inserter(inactive_nodes_in_bc_mesh),
[&](MeshLib::Node* const n) {
[&](MeshLib::Node* const n)
{
const auto& connected_elements = n->getElements();
return std::all_of(begin(connected_elements),
......@@ -89,7 +92,8 @@ void DeactivatedSubdomainDirichlet::getEssentialBCValues(
});
}
auto time_interval_contains = [&](double const t) {
auto time_interval_contains = [&](double const t)
{
return _time_interval.getSupportMin() <= t &&
t <= _time_interval.getSupportMax();
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment