コード例 #1
0
ファイル: NeumannBc.cpp プロジェクト: coderpainter/ogs
NeumannBc::NeumannBc(
    NeumannBcConfig const& bc,
    unsigned const integration_order,
    NumLib::LocalToGlobalIndexMap const& local_to_global_index_map,
    int const variable_id,
    int const component_id)
    : _function(*bc.getFunction()),
      _integration_order(integration_order)
{
    assert(component_id < static_cast<int>(local_to_global_index_map.getNumberOfComponents()));

    // deep copy because the neumann bc config destroys the elements.
    std::transform(bc.elementsBegin(), bc.elementsEnd(),
            std::back_inserter(_elements),
            std::mem_fn(&MeshLib::Element::clone));

    std::vector<MeshLib::Node*> nodes = MeshLib::getUniqueNodes(_elements);

    auto const& mesh_subsets =
        local_to_global_index_map.getMeshSubsets(variable_id, component_id);

    // TODO extend the node intersection to all parts of mesh_subsets, i.e.
    // to each of the MeshSubset in the mesh_subsets.
    _mesh_subset_all_nodes =
        mesh_subsets.getMeshSubset(0).getIntersectionByNodes(nodes);
    std::unique_ptr<MeshLib::MeshSubsets> all_mesh_subsets{
        new MeshLib::MeshSubsets{_mesh_subset_all_nodes}};

    // Create local DOF table from intersected mesh subsets for the given
    // variable and component ids.
    _local_to_global_index_map.reset(
        local_to_global_index_map.deriveBoundaryConstrainedMap(
            variable_id, component_id, std::move(all_mesh_subsets),
            _elements));
}
コード例 #2
0
void DirichletBoundaryConditionWithinTimeInterval::config(
    NumLib::LocalToGlobalIndexMap const& dof_table_bulk)
{
    checkParametersOfDirichletBoundaryCondition(_bc_mesh, dof_table_bulk,
                                                _variable_id, _component_id);

    std::vector<MeshLib::Node*> const& bc_nodes = _bc_mesh.getNodes();
    MeshLib::MeshSubset bc_mesh_subset(_bc_mesh, bc_nodes);

    // Create local DOF table from the BC mesh subset for the given variable
    // and component id.
    _dof_table_boundary.reset(dof_table_bulk.deriveBoundaryConstrainedMap(
        _variable_id, {_component_id}, std::move(bc_mesh_subset)));
}