dune-grid-glue  2.4-git
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ContactMerge< dimworld, T > Class Template Referenceabstract

Merge two codimension-1 surfaces that may be a positive distance apart. More...

#include <dune/grid-glue/merging/contactmerge.hh>

Inheritance diagram for ContactMerge< dimworld, T >:
Inheritance graph

Public Types

typedef T ctype
 the numeric type used in this interface More...
 
typedef Dune::FieldVector< T, dimworld > WorldCoords
 the coordinate type used in this interface More...
 
typedef Dune::FieldVector< T, dim > LocalCoords
 the coordinate type used in this interface More...
 
typedef Merger< T, grid1Dim, grid2Dim, dimworld >::Grid1Coords Grid1Coords
 Type used for local coordinates on the grid1 side. More...
 
typedef Merger< T, grid1Dim, grid2Dim, dimworld >::Grid2Coords Grid2Coords
 Type used for local coordinates on the grid2 side. More...
 

Public Member Functions

 ContactMerge (const T allowedOverlap=T(0), const Dune::VirtualFunction< WorldCoords, WorldCoords > *domainDirections=NULL, const Dune::VirtualFunction< WorldCoords, WorldCoords > *targetDirections=NULL)
 
void setSurfaceDirections (const Dune::VirtualFunction< WorldCoords, WorldCoords > *domainDirections, const Dune::VirtualFunction< WorldCoords, WorldCoords > *targetDirections)
 Set surface direction functions. More...
 
void setOverlap (T overlap)
 Set the allowed overlap of the surfaces. More...
 
unsigned int nSimplices () const
 get the number of simplices in the merged grid The indices are then in 0..nSimplices()-1 More...
 
void clear ()
 
unsigned int parents (unsigned int idx) const
 
unsigned int parent (unsigned int idx, unsigned int parId=0) const
 get index of grid-n's parent simplex for given merged grid simplex More...
 
bool simplexRefined (unsigned int idx, std::vector< unsigned int > &indices) const
 get the merged grid simplices refining a given grid-n simplex More...
 
GridTraits< n >::Coords 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's index can be obtained via "parent<n>") More...
 

Public Attributes

unsigned int counter
 Counts the number of times the computeIntersection method has been called. More...
 

Protected Types

typedef StandardMerge< T, dimworld-1, dimworld-1, dimworld >::RemoteSimplicialIntersection RemoteSimplicialIntersection
 

Protected Member Functions

void build (const std::vector< Dune::FieldVector< T, dimworld > > &grid1Coords, const std::vector< unsigned int > &grid1Elements, const std::vector< Dune::GeometryType > &grid1ElementTypes, const std::vector< Dune::FieldVector< T, dimworld > > &grid2Coords, const std::vector< unsigned int > &grid2Elements, const std::vector< Dune::GeometryType > &grid2ElementTypes)
 
bool isFeasibleProjection (const std::vector< WorldCoords > &elementCorners, const std::vector< WorldCoords > &contactDirections, const Dune::GeometryType &gt, const WorldCoords &preImage, const WorldCoords &preContactDirection, const LocalCoords &localCoords)
 Check if the projection of a point and an opposing face is valid. More...
 
void computeCyclicOrder (const std::vector< std::array< LocalCoords, 2 > > &polytopeCorners, const LocalCoords &center, std::vector< int > &ordering) const
 Order the corners of the intersection polytope in cyclic order. More...
 
void setupNodalDirections (const std::vector< WorldCoords > &coords1, const std::vector< unsigned int > &elements1, const std::vector< Dune::GeometryType > &elementTypes1, const std::vector< WorldCoords > &coords2, const std::vector< unsigned int > &elements2, const std::vector< Dune::GeometryType > &elementTypes2)
 Setup the direction vectors containing the directions for each vertex. More...
 
void computeOuterNormalField (const std::vector< WorldCoords > &coords, const std::vector< unsigned int > &elements, const std::vector< Dune::GeometryType > &elementTypes, std::vector< WorldCoords > &normals)
 If no direction field was specified compute the outer normal field. More...
 
void removeDoubles (std::vector< std::array< LocalCoords, 2 > > &polytopeCorners)
 Remove all multiples. More...
 
virtual void computeIntersections (const Dune::GeometryType &grid1ElementType, const std::vector< Dune::FieldVector< T, dimworld > > &grid1ElementCorners, std::bitset<(1<< grid1Dim)> &neighborIntersects1, unsigned int grid1Index, const Dune::GeometryType &grid2ElementType, const std::vector< Dune::FieldVector< T, dimworld > > &grid2ElementCorners, std::bitset<(1<< grid2Dim)> &neighborIntersects2, unsigned int grid2Index, std::vector< RemoteSimplicialIntersection > &intersections)=0
 Compute the intersection between two overlapping elements. More...
 
bool computeIntersection (unsigned int candidate0, unsigned int candidate1, const std::vector< Dune::FieldVector< T, dimworld > > &grid1Coords, const std::vector< Dune::GeometryType > &grid1_element_types, std::bitset<(1<< grid1Dim)> &neighborIntersects1, const std::vector< Dune::FieldVector< T, dimworld > > &grid2Coords, const std::vector< Dune::GeometryType > &grid2_element_types, std::bitset<(1<< grid2Dim)> &neighborIntersects2, bool insert=true)
 Compute the intersection between two overlapping elements. More...
 

Static Protected Member Functions

static WorldCoords interpolate (const std::vector< WorldCoords > &p, const Dune::GeometryType &gt, const LocalCoords &local)
 Compute global coordinates of a local point using linear interpolation of the corners. More...
 

Protected Attributes

bool valid
 
std::vector< RemoteSimplicialIntersectionintersections_
 The computed intersections. More...
 
std::vector< std::vector< unsigned int > > grid1ElementCorners_
 Temporary internal data. More...
 
std::vector< std::vector< unsigned int > > grid2ElementCorners_
 
std::vector< std::vector< int > > elementNeighbors1_
 
std::vector< std::vector< int > > elementNeighbors2_
 

Detailed Description

template<int dimworld, typename T = double>
class ContactMerge< dimworld, T >

Merge two codimension-1 surfaces that may be a positive distance apart.

Template Parameters
dimworldDimension of the world coordinates.
TType used for coordinates

Member Typedef Documentation

template<int dimworld, typename T = double>
typedef T ContactMerge< dimworld, T >::ctype

the numeric type used in this interface

typedef Merger<T,grid1Dim,grid2Dim,dimworld>::Grid1Coords StandardMerge< T, grid1Dim, grid2Dim, dimworld >::Grid1Coords
inherited

Type used for local coordinates on the grid1 side.

typedef Merger<T,grid1Dim,grid2Dim,dimworld>::Grid2Coords StandardMerge< T, grid1Dim, grid2Dim, dimworld >::Grid2Coords
inherited

Type used for local coordinates on the grid2 side.

template<int dimworld, typename T = double>
typedef Dune::FieldVector<T, dim> ContactMerge< dimworld, T >::LocalCoords

the coordinate type used in this interface

template<int dimworld, typename T = double>
typedef StandardMerge<T,dimworld-1,dimworld-1,dimworld>::RemoteSimplicialIntersection ContactMerge< dimworld, T >::RemoteSimplicialIntersection
protected
template<int dimworld, typename T = double>
typedef Dune::FieldVector<T, dimworld> ContactMerge< dimworld, T >::WorldCoords

the coordinate type used in this interface

Constructor & Destructor Documentation

template<int dimworld, typename T = double>
ContactMerge< dimworld, T >::ContactMerge ( const T  allowedOverlap = T(0),
const Dune::VirtualFunction< WorldCoords, WorldCoords > *  domainDirections = NULL,
const Dune::VirtualFunction< WorldCoords, WorldCoords > *  targetDirections = NULL 
)
inline

Member Function Documentation

template<int dimworld, typename T = double>
void ContactMerge< dimworld, T >::build ( const std::vector< Dune::FieldVector< T, dimworld > > &  grid1Coords,
const std::vector< unsigned int > &  grid1Elements,
const std::vector< Dune::GeometryType > &  grid1ElementTypes,
const std::vector< Dune::FieldVector< T, dimworld > > &  grid2Coords,
const std::vector< unsigned int > &  grid2Elements,
const std::vector< Dune::GeometryType > &  grid2ElementTypes 
)
inlineprotectedvirtual
void StandardMerge< T, grid1Dim, grid2Dim, dimworld >::clear ( )
inlinevirtualinherited
template<int dimworld, typename T >
void ContactMerge< dimworld, T >::computeCyclicOrder ( const std::vector< std::array< LocalCoords, 2 > > &  polytopeCorners,
const LocalCoords center,
std::vector< int > &  ordering 
) const
protected

Order the corners of the intersection polytope in cyclic order.

bool StandardMerge< T, grid1Dim, grid2Dim, dimworld >::computeIntersection ( unsigned int  candidate0,
unsigned int  candidate1,
const std::vector< Dune::FieldVector< T, dimworld > > &  grid1Coords,
const std::vector< Dune::GeometryType > &  grid1_element_types,
std::bitset<(1<< grid1Dim)> &  neighborIntersects1,
const std::vector< Dune::FieldVector< T, dimworld > > &  grid2Coords,
const std::vector< Dune::GeometryType > &  grid2_element_types,
std::bitset<(1<< grid2Dim)> &  neighborIntersects2,
bool  insert = true 
)
protectedinherited

Compute the intersection between two overlapping elements.

Returns
true if at least one intersection point was found
virtual void StandardMerge< T, grid1Dim, grid2Dim, dimworld >::computeIntersections ( const Dune::GeometryType &  grid1ElementType,
const std::vector< Dune::FieldVector< T, dimworld > > &  grid1ElementCorners,
std::bitset<(1<< grid1Dim)> &  neighborIntersects1,
unsigned int  grid1Index,
const Dune::GeometryType &  grid2ElementType,
const std::vector< Dune::FieldVector< T, dimworld > > &  grid2ElementCorners,
std::bitset<(1<< grid2Dim)> &  neighborIntersects2,
unsigned int  grid2Index,
std::vector< RemoteSimplicialIntersection > &  intersections 
)
protectedpure virtualinherited

Compute the intersection between two overlapping elements.

The result is a set of simplices stored in the vector intersections.

template<int dimworld, typename T >
void ContactMerge< dimworld, T >::computeOuterNormalField ( const std::vector< WorldCoords > &  coords,
const std::vector< unsigned int > &  elements,
const std::vector< Dune::GeometryType > &  elementTypes,
std::vector< WorldCoords > &  normals 
)
protected

If no direction field was specified compute the outer normal field.

References Projection::crossProduct().

template<int dimworld, typename T = double>
static WorldCoords ContactMerge< dimworld, T >::interpolate ( const std::vector< WorldCoords > &  p,
const Dune::GeometryType &  gt,
const LocalCoords local 
)
inlinestaticprotected

Compute global coordinates of a local point using linear interpolation of the corners.

Referenced by ContactMerge< dimworld, T >::isFeasibleProjection().

template<int dimworld, typename T = double>
bool ContactMerge< dimworld, T >::isFeasibleProjection ( const std::vector< WorldCoords > &  elementCorners,
const std::vector< WorldCoords > &  contactDirections,
const Dune::GeometryType &  gt,
const WorldCoords preImage,
const WorldCoords preContactDirection,
const LocalCoords localCoords 
)
inlineprotected

Check if the projection of a point and an opposing face is valid.

Parameters
elementCornersGlobal coordinates of the corners of the face that was projected on.
contactDirectionsContact diections for each corner the face that was projected on.
gtThe geometry type of the face that was projected on.
preImageThe point that was projected.
preContactDirectionThe contact direction of the point that was projected.
localCoordsLocal coordinates of the projected point.
Returns
Returns true if the projection is valid.

References ContactMerge< dimworld, T >::interpolate().

unsigned int StandardMerge< T, grid1Dim, grid2Dim, dimworld >::nSimplices ( ) const
virtualinherited

get the number of simplices in the merged grid The indices are then in 0..nSimplices()-1

Implements Merger< T, grid1Dim, grid2Dim, dimworld >.

unsigned int Merger< T , grid1Dim, grid2Dim, dimworld >::parent ( unsigned int  idx,
unsigned int  parId = 0 
) const
inlineinherited

get index of grid-n's parent simplex for given merged grid simplex

Template Parameters
nspecify which grid
Parameters
idxindex of the merged grid simplex
Returns
index of the parent simplex
GridTraits<n>::Coords Merger< T , grid1Dim, grid2Dim, dimworld >::parentLocal ( unsigned int  idx,
unsigned int  corner,
unsigned int  parId = 0 
) const
inlineinherited

get the grid-n parent's simplex local coordinates for a particular merged grid simplex corner (parent's index can be obtained via "parent<n>")

Template Parameters
nspecify which grid
Parameters
idxthe index of the merged grid simplex
cornerthe index of the simplex' corner
Returns
local coordinates in grid-n grid1
unsigned int Merger< T , grid1Dim, grid2Dim, dimworld >::parents ( unsigned int  idx) const
inlineinherited

doc me

template<int dimworld, typename T >
void ContactMerge< dimworld, T >::removeDoubles ( std::vector< std::array< LocalCoords, 2 > > &  polytopeCorners)
protected

Remove all multiples.

template<int dimworld, typename T = double>
void ContactMerge< dimworld, T >::setOverlap ( overlap)
inline

Set the allowed overlap of the surfaces.

template<int dimworld, typename T = double>
void ContactMerge< dimworld, T >::setSurfaceDirections ( const Dune::VirtualFunction< WorldCoords, WorldCoords > *  domainDirections,
const Dune::VirtualFunction< WorldCoords, WorldCoords > *  targetDirections 
)
inline

Set surface direction functions.

The matching of the geometries offers the possibility to specify a function for the exact evaluation of domain surface normals. If no such function is specified (default) normals are interpolated.

Parameters
valuethe new function (or NULL to unset the function)

References StandardMerge< T, dimworld-1, dimworld-1, dimworld >::valid.

template<int dimworld, typename T >
void ContactMerge< dimworld, T >::setupNodalDirections ( const std::vector< WorldCoords > &  coords1,
const std::vector< unsigned int > &  elements1,
const std::vector< Dune::GeometryType > &  elementTypes1,
const std::vector< WorldCoords > &  coords2,
const std::vector< unsigned int > &  elements2,
const std::vector< Dune::GeometryType > &  elementTypes2 
)
protected

Setup the direction vectors containing the directions for each vertex.

Referenced by ContactMerge< dimworld, T >::build().

bool Merger< T , grid1Dim, grid2Dim, dimworld >::simplexRefined ( unsigned int  idx,
std::vector< unsigned int > &  indices 
) const
inlineinherited

get the merged grid simplices refining a given grid-n simplex

Template Parameters
nspecify which grid (grid1/grid2: 0/1)
Parameters
idxindex of grid-n simplex
indiceswill be resized first and then filled with the refining simplices
Returns
TRUE <=> given simplex could be matched and is part of the merged grid

Member Data Documentation

unsigned int Merger< T , grid1Dim, grid2Dim, dimworld >::counter
inherited

Counts the number of times the computeIntersection method has been called.

Used temporarily to speed up the implementation

Referenced by StandardMerge< T, grid1Dim, grid2Dim, dimworld >::build().

std::vector<std::vector<int> > StandardMerge< T, grid1Dim, grid2Dim, dimworld >::elementNeighbors1_
protectedinherited
std::vector<std::vector<int> > StandardMerge< T, grid1Dim, grid2Dim, dimworld >::elementNeighbors2_
protectedinherited
std::vector<std::vector<unsigned int> > StandardMerge< T, grid1Dim, grid2Dim, dimworld >::grid1ElementCorners_
protectedinherited

Temporary internal data.

std::vector<std::vector<unsigned int> > StandardMerge< T, grid1Dim, grid2Dim, dimworld >::grid2ElementCorners_
protectedinherited
std::vector<RemoteSimplicialIntersection> StandardMerge< T, grid1Dim, grid2Dim, dimworld >::intersections_
protectedinherited

The computed intersections.

bool StandardMerge< T, grid1Dim, grid2Dim, dimworld >::valid
protectedinherited

The documentation for this class was generated from the following files: