Loading...
Searching...
No Matches
merger.hh
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
#ifndef DUNE_GRIDGLUE_MERGING_MERGER_HH
#define DUNE_GRIDGLUE_MERGING_MERGER_HH
#include <vector>
#include <dune/common/fvector.hh>
#include <dune/geometry/type.hh>
#include <dune/grid-glue/merging/intersectionlist.hh>
namespace Dune {
namespace GridGlue {
template <class ctype, int grid1Dim, int grid2Dim, int dimworld>
class Merger
{
public:
typedef Dune::FieldVector<ctype, grid1Dim> Grid1Coords;
typedef Dune::FieldVector<ctype, grid2Dim> Grid2Coords;
typedef Dune::FieldVector<ctype, dimworld> WorldCoords;
using IntersectionList = Dune::GridGlue::IntersectionList<Grid1Coords, Grid2Coords>;
virtual void build(const std::vector<Dune::FieldVector<ctype,dimworld> >& grid1_coords,
const std::vector<unsigned int>& grid1_elements,
const std::vector<Dune::GeometryType>& grid1_element_types,
const std::vector<Dune::FieldVector<ctype,dimworld> >& grid2_coords,
const std::vector<unsigned int>& grid2_elements,
const std::vector<Dune::GeometryType>& grid2_element_types) = 0;
unsigned int nSimplices() const
{ return intersectionList()->size(); }
virtual void clear() = 0;
virtual std::shared_ptr<IntersectionList> intersectionList() const = 0;
template<int n>
unsigned int parents(unsigned int idx) const {
return intersectionList()->template parents<n>(idx);
}
template<int n>
unsigned int parent(unsigned int idx, unsigned int parId = 0) const
{
return intersectionList()->template parent<n>(idx, parId);
}
template<int n>
auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId = 0) const
{
return intersectionList()->template corner<n>(idx, corner, parId);
}
unsigned int counter;
};
} /* namespace GridGlue */
} /* namespace Dune */
#endif
intersectionlist.hh
Dune
Definition gridglue.hh:37
Dune::GridGlue
Definition gridglue.hh:38
Dune::GridGlue::IntersectionList
Definition intersectionlist.hh:134
Dune::GridGlue::IntersectionList::size
std::size_t size() const
Definition intersectionlist.hh:146
Dune::GridGlue::Merger
Abstract base for all classes that take extracted grids and build sets of intersections.
Definition merger.hh:27
Dune::GridGlue::Merger::parent
unsigned int parent(unsigned int idx, unsigned int parId=0) const
get index of grid-n's parent simplex for given merged grid simplex
Definition merger.hh:91
Dune::GridGlue::Merger::clear
virtual void clear()=0
Dune::GridGlue::Merger< ctype, Grid< 0 >::dimension - GridPatch< 0 >::codim, Grid< 1 >::dimension - GridPatch< 1 >::codim, dimworld >::WorldCoords
Dune::FieldVector< ctype, dimworld > WorldCoords
Definition merger.hh:37
Dune::GridGlue::Merger< ctype, Grid< 0 >::dimension - GridPatch< 0 >::codim, Grid< 1 >::dimension - GridPatch< 1 >::codim, dimworld >::IntersectionList
Dune::GridGlue::IntersectionList< Grid1Coords, Grid2Coords > IntersectionList
Definition merger.hh:39
Dune::GridGlue::Merger< ctype, Grid< 0 >::dimension - GridPatch< 0 >::codim, Grid< 1 >::dimension - GridPatch< 1 >::codim, dimworld >::Grid1Coords
Dune::FieldVector< ctype, grid1Dim > Grid1Coords
Definition merger.hh:31
Dune::GridGlue::Merger< ctype, Grid< 0 >::dimension - GridPatch< 0 >::codim, Grid< 1 >::dimension - GridPatch< 1 >::codim, dimworld >::counter
unsigned int counter
Definition merger.hh:114
Dune::GridGlue::Merger::parentLocal
auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId=0) const
get the grid-n parent's simplex local coordinates for a particular merged grid simplex corner (parent...
Definition merger.hh:105
Dune::GridGlue::Merger::build
virtual void build(const std::vector< Dune::FieldVector< ctype, dimworld > > &grid1_coords, const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< ctype, dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements, const std::vector< Dune::GeometryType > &grid2_element_types)=0
builds the merged grid
Dune::GridGlue::Merger::nSimplices
unsigned int nSimplices() const
get the number of simplices in the merged grid The indices are then in 0..nSimplices()-1
Definition merger.hh:64
Dune::GridGlue::Merger::intersectionList
virtual std::shared_ptr< IntersectionList > intersectionList() const =0
Dune::GridGlue::Merger::parents
unsigned int parents(unsigned int idx) const
Definition merger.hh:80
Dune::GridGlue::Merger< ctype, Grid< 0 >::dimension - GridPatch< 0 >::codim, Grid< 1 >::dimension - GridPatch< 1 >::codim, dimworld >::Grid2Coords
Dune::FieldVector< ctype, grid2Dim > Grid2Coords
Definition merger.hh:34