Loading...
Searching...
No Matches
SubDomain.h
// Copyright (C) 2007-2013 Anders Logg
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added: 2007-04-10
// Last changed: 2013-04-12
#ifndef __SUB_DOMAIN_H
#define __SUB_DOMAIN_H
#include <cstddef>
#include <map>
#include <dolfin/common/constants.h>
#include <Eigen/Dense>
namespace dolfin
{
// Forward declarations
class Mesh;
template <typename T> class MeshFunction;
template <typename T> class MeshValueCollection;
template <typename T> class Array;
class SubDomain
{
public:
SubDomain(const double map_tol=1.0e-10);
virtual ~SubDomain();
virtual bool inside(const Array<double>& x, bool on_boundary) const;
virtual bool inside(Eigen::Ref<const Eigen::VectorXd> x, bool on_boundary) const;
virtual void map(const Array<double>& x, Array<double>& y) const;
virtual void map(Eigen::Ref<const Eigen::VectorXd> x, Eigen::Ref<Eigen::VectorXd> y) const;
virtual void snap(Array<double>& x) const;
virtual void snap(Eigen::Ref<Eigen::VectorXd> x) const;
//--- Marking of Mesh ---
void mark_cells(Mesh& mesh,
std::size_t sub_domain,
bool check_midpoint=true) const;
void mark_facets(Mesh& mesh,
std::size_t sub_domain,
bool check_midpoint=true) const;
void mark(Mesh& mesh,
std::size_t dim,
std::size_t sub_domain,
bool check_midpoint=true) const;
//--- Marking of MeshFunction ---
void mark(MeshFunction<std::size_t>& sub_domains,
std::size_t sub_domain,
bool check_midpoint=true) const;
void mark(MeshFunction<int>& sub_domains,
int sub_domain,
bool check_midpoint=true) const;
void mark(MeshFunction<double>& sub_domains,
double sub_domain,
bool check_midpoint=true) const;
void mark(MeshFunction<bool>& sub_domains,
bool sub_domain,
bool check_midpoint=true) const;
//--- Marking of MeshValueCollection ---
void mark(MeshValueCollection<std::size_t>& sub_domains,
std::size_t sub_domain,
const Mesh& mesh,
bool check_midpoint=true) const;
void mark(MeshValueCollection<int>& sub_domains,
int sub_domain,
const Mesh& mesh,
bool check_midpoint=true) const;
void mark(MeshValueCollection<double>& sub_domains,
double sub_domain,
const Mesh& mesh,
bool check_midpoint=true) const;
void mark(MeshValueCollection<bool>& sub_domains,
bool sub_domain,
const Mesh& mesh,
bool check_midpoint=true) const;
std::size_t geometric_dimension() const;
virtual void set_property(std::string name, double value);
virtual double get_property(std::string name) const;
const double map_tolerance;
private:
template<typename S, typename T>
void apply_markers(S& sub_domains,
T sub_domain,
const Mesh& mesh,
bool check_midpoint) const;
template<typename T>
void apply_markers(std::map<std::size_t, std::size_t>& sub_domains,
std::size_t dim,
T sub_domain,
const Mesh& mesh,
bool check_midpoint) const;
// Friends
friend class DirichletBC;
friend class PeriodicBC;
// Geometric dimension, needed for SWIG interface, will be set before
// calls to inside() and map()
mutable std::size_t _geometric_dimension;
};
}
#endif
dolfin::Array
Definition Array.h:42
dolfin::MeshFunction
Definition MeshFunction.h:58
dolfin::MeshValueCollection
Definition MeshValueCollection.h:51
dolfin::Mesh
Definition Mesh.h:84
dolfin::SubDomain::get_property
virtual double get_property(std::string name) const
Definition SubDomain.cpp:401
dolfin::SubDomain::SubDomain
SubDomain(const double map_tol=1.0e-10)
Definition SubDomain.cpp:40
dolfin::SubDomain::mark
void mark(Mesh &mesh, std::size_t dim, std::size_t sub_domain, bool check_midpoint=true) const
Definition SubDomain.cpp:107
dolfin::SubDomain::~SubDomain
virtual ~SubDomain()
Destructor.
Definition SubDomain.cpp:46
dolfin::SubDomain::inside
virtual bool inside(const Array< double > &x, bool on_boundary) const
Definition SubDomain.cpp:51
dolfin::SubDomain::set_property
virtual void set_property(std::string name, double value)
Definition SubDomain.cpp:394
dolfin::SubDomain::geometric_dimension
std::size_t geometric_dimension() const
Definition SubDomain.cpp:178
dolfin::SubDomain::map_tolerance
const double map_tolerance
Definition SubDomain.h:286
dolfin::SubDomain::mark_facets
void mark_facets(Mesh &mesh, std::size_t sub_domain, bool check_midpoint=true) const
Definition SubDomain.cpp:100
dolfin::SubDomain::snap
virtual void snap(Array< double > &x) const
Definition SubDomain.cpp:80
dolfin::SubDomain::mark_cells
void mark_cells(Mesh &mesh, std::size_t sub_domain, bool check_midpoint=true) const
Definition SubDomain.cpp:93
dolfin::SubDomain::map
virtual void map(const Array< double > &x, Array< double > &y) const
Definition SubDomain.cpp:65
dolfin
Definition adapt.h:30