14 #ifndef DUNE_GRIDGLUE_MERGING_PSURFACEMERGE_HH 15 #define DUNE_GRIDGLUE_MERGING_PSURFACEMERGE_HH 17 #warning PSurfaceMerge is deprecated. Please use ContactMerge or OverlappingMerge instead. 21 #include <dune/common/shared_ptr.hh> 27 #include <psurface/DirectionFunction.h> 30 template <
int dim,
typename ctype>
class DirectionFunction;
32 #define PSURFACE_NAMESPACE 39 namespace Implementation {
41 template<
typename Vector>
43 :
public Dune::VirtualFunction<Vector, Vector>
45 using ctype =
typename Vector::field_type;
46 const static unsigned int dim = Vector::dimension;
47 using DF =
typename PSURFACE_NAMESPACE DirectionFunction<dim, ctype>;
48 using ADF =
typename PSURFACE_NAMESPACE AnalyticDirectionFunction<dim, ctype>;
50 std::shared_ptr<const ADF> m_direction;
54 : m_direction(
std::dynamic_pointer_cast<const ADF>(direction))
57 DUNE_THROW(Dune::Exception,
"Only psurface's AnalyticDirectionFunction is supported.");
60 void evaluate(
const Vector& x, Vector& y)
const override 62 PSURFACE_NAMESPACE StaticVector<ctype, dim> x_, y_;
63 for (std::size_t i = 0; i < dim; ++i)
65 y_ = (*m_direction)(x_);
66 for (std::size_t i = 0; i < dim; ++i)
74 template<
int dim,
int dimworld,
typename T =
double,
typename =
void>
83 template<
int dim,
int dimworld,
typename T>
89 static_assert(dim+1 == dimworld,
"The PSurfaceMerger only supports dim==dimworld and dim+1==dimworld");
106 std::shared_ptr<const Dune::VirtualFunction<WorldCoords, WorldCoords> > psurfaceDomainDirections_;
116 std::shared_ptr<const Dune::VirtualFunction<WorldCoords, WorldCoords> > psurfaceTargetDirections_;
121 PSurfaceMerge(
const PSURFACE_NAMESPACE DirectionFunction<dimworld,ctype>* domainDirections,
122 const PSURFACE_NAMESPACE DirectionFunction<dimworld,ctype>* targetDirections)
123 :
PSurfaceMerge(
Dune::stackobject_to_shared_ptr(*domainDirections),
Dune::stackobject_to_shared_ptr(*targetDirections))
126 PSurfaceMerge(std::shared_ptr<
const PSURFACE_NAMESPACE DirectionFunction<dimworld,ctype> > domainDirections =
nullptr,
127 std::shared_ptr<
const PSURFACE_NAMESPACE DirectionFunction<dimworld,ctype> > targetDirections =
nullptr)
129 this->minNormalAngle(0.0);
130 this->enableFallback(
true);
131 setSurfaceDirections(domainDirections, targetDirections);
134 using Base::setSurfaceDirections;
146 const PSURFACE_NAMESPACE DirectionFunction<dimworld,ctype>* targetDirections)
148 setSurfaceDirections(Dune::stackobject_to_shared_ptr(*domainDirections), Dune::stackobject_to_shared_ptr(*targetDirections));
151 void setSurfaceDirections(std::shared_ptr<
const PSURFACE_NAMESPACE DirectionFunction<dimworld,ctype> > domainDirections,
152 std::shared_ptr<
const PSURFACE_NAMESPACE DirectionFunction<dimworld,ctype> > targetDirections)
156 psurfaceDomainDirections_ = domainDirections ? std::make_shared<Adapter>(domainDirections) :
nullptr;
157 psurfaceTargetDirections_ = targetDirections ? std::make_shared<Adapter>(domainDirections) :
nullptr;
159 this->setSurfaceDirections(psurfaceDomainDirections_.get(), psurfaceTargetDirections_.get());
164 template<
int dimworld,
typename T>
174 #endif // DUNE_GRIDGLUE_MERGING_PSURFACEMERGE_HH Dune::FieldVector< T, dim > LocalCoords
the coordinate type used in this interface
Definition: psurfacemerge.hh:99
void evaluate(const Vector &x, Vector &y) const override
Definition: psurfacemerge.hh:60
Definition: psurfacemerge.hh:42
Computing overlapping grid intersections for grids of different dimensions.
Definition: overlappingmerge.hh:34
Definition: gridglue.hh:33
void setSurfaceDirections(const PSURFACE_NAMESPACE DirectionFunction< dimworld, ctype > *domainDirections, const PSURFACE_NAMESPACE DirectionFunction< dimworld, ctype > *targetDirections)
Set surface direction functions.
Definition: psurfacemerge.hh:145
PSurfaceDirectionFunctionAdapter(const std::shared_ptr< const DF > direction)
Definition: psurfacemerge.hh:53
Dune::FieldVector< T, dimworld > WorldCoords
the coordinate type used in this interface
Definition: psurfacemerge.hh:96
PSurfaceMerge(const PSURFACE_NAMESPACE DirectionFunction< dimworld, ctype > *domainDirections, const PSURFACE_NAMESPACE DirectionFunction< dimworld, ctype > *targetDirections)
Definition: psurfacemerge.hh:121
PSurfaceMerge(std::shared_ptr< const PSURFACE_NAMESPACE DirectionFunction< dimworld, ctype > > domainDirections=nullptr, std::shared_ptr< const PSURFACE_NAMESPACE DirectionFunction< dimworld, ctype > > targetDirections=nullptr)
Definition: psurfacemerge.hh:126
Merge two codimension-1 surfaces that may be a positive distance apart.
Definition: contactmerge.hh:39
void setSurfaceDirections(std::shared_ptr< const PSURFACE_NAMESPACE DirectionFunction< dimworld, ctype > > domainDirections, std::shared_ptr< const PSURFACE_NAMESPACE DirectionFunction< dimworld, ctype > > targetDirections)
Definition: psurfacemerge.hh:151
Merge two grid boundary surfaces that may be a positive distance apart.
Definition: psurfacemerge.hh:75
T ctype
the numeric type used in this interface
Definition: psurfacemerge.hh:89