23 #ifndef __MULTI_MESH_H 24 #define __MULTI_MESH_H 31 #include <dolfin/common/Variable.h> 32 #include <dolfin/geometry/Point.h> 41 class BoundingBoxTree;
42 class SimplexQuadrature;
61 typedef std::pair<std::vector<Simplex>, std::set<std::size_t>>
Polyhedron;
70 MultiMesh(std::vector<std::shared_ptr<const Mesh>> meshes,
71 std::size_t quadrature_order);
76 MultiMesh(std::shared_ptr<const Mesh> mesh_0,
77 std::size_t quadrature_order);
80 MultiMesh(std::shared_ptr<const Mesh> mesh_0,
81 std::shared_ptr<const Mesh> mesh_1,
82 std::size_t quadrature_order);
85 MultiMesh(std::shared_ptr<const Mesh> mesh_0,
86 std::shared_ptr<const Mesh> mesh_1,
87 std::shared_ptr<const Mesh> mesh_2,
88 std::size_t quadrature_order);
109 std::shared_ptr<const Mesh>
part(std::size_t i)
const;
141 const std::vector<unsigned int>
cut_cells(std::size_t
part)
const;
165 void mark_covered(std::size_t
part,
const std::vector<unsigned int>& cells);
178 const std::map<
unsigned int,
179 std::vector<std::pair<std::size_t, unsigned int> > >&
194 const std::map<unsigned int, quadrature_rule >&
211 const quadrature_rule
228 const std::map<unsigned int, std::vector<quadrature_rule> >&
249 const std::vector<quadrature_rule>
267 const std::map<unsigned int, std::vector<quadrature_rule> >&
293 const std::vector<quadrature_rule>
295 unsigned int cell_index)
const;
315 const std::map<unsigned int, std::vector<std::vector<double> > >&
327 std::shared_ptr<const BoundingBoxTree>
340 std::shared_ptr<const BoundingBoxTree>
348 void add(std::shared_ptr<const Mesh> mesh);
351 void build(std::size_t quadrature_order=2);
365 p.
add(
"compress_volume_quadrature",
false);
366 p.
add(
"compress_interface_quadrature",
false);
384 const std::string& filename=
"")
const;
397 std::vector<std::shared_ptr<const Mesh> > _meshes;
400 std::vector<std::shared_ptr<BoundaryMesh> > _boundary_meshes;
403 std::vector<std::shared_ptr<BoundingBoxTree> > _trees;
406 std::vector<std::shared_ptr<BoundingBoxTree> > _boundary_trees;
417 std::vector<std::vector<unsigned int> > _uncut_cells;
428 std::vector<std::vector<unsigned int> > _covered_cells;
452 std::vector<std::map<
unsigned int,
453 std::vector<std::pair<std::size_t, unsigned int> > > >
454 _collision_maps_cut_cells;
466 std::vector<std::map<unsigned int, quadrature_rule> >
467 _quadrature_rules_cut_cells;
480 std::vector<std::map<unsigned int, std::vector<quadrature_rule> > >
481 _quadrature_rules_overlap;
494 std::vector<std::map<unsigned int, std::vector<quadrature_rule> > >
495 _quadrature_rules_interface;
508 std::vector<std::map<unsigned int, std::vector<std::vector<double> > > >
512 void _build_boundary_meshes();
515 void _build_bounding_box_trees();
518 void _build_collision_maps();
523 void _build_quadrature_rules_cut_cells(std::size_t quadrature_order);
526 void _build_quadrature_rules_overlap(std::size_t quadrature_order);
529 void _build_quadrature_rules_interface(std::size_t quadrature_order);
533 bool _is_overlapped_interface(std::vector<Point> simplex,
535 Point simplex_normal)
const;
539 std::size_t _add_quadrature_rule(quadrature_rule& qr,
541 const Simplex& simplex,
543 std::size_t quadrature_order,
544 double factor)
const;
548 std::size_t _add_quadrature_rule(quadrature_rule& qr,
549 const quadrature_rule& dqr,
551 double factor)
const;
554 void _add_normal(std::vector<double>& normals,
557 std::size_t gdim)
const;
563 void _inclusion_exclusion_overlap
564 (std::vector<quadrature_rule>& qr,
566 const std::vector<std::pair<std::size_t, Polyhedron> >& initial_polyhedra,
569 std::size_t quadrature_order)
const;
572 void _inclusion_exclusion_interface
573 (quadrature_rule& qr,
574 std::vector<double>& normals,
577 const Point& facet_normal,
578 const std::vector<std::pair<std::size_t, Polyhedron> >& initial_polygons,
581 std::size_t quadrature_order)
const;
584 std::vector<std::vector<std::pair<std::size_t, std::size_t> > >
585 _boundary_facets_to_full_mesh(std::size_t
part)
const;
589 void _impose_cut_cell_consistency();
593 static void remove_quadrature_rule(quadrature_rule& qr,
void mark_covered(std::size_t part, const std::vector< unsigned int > &cells)
Definition: MultiMesh.cpp:153
Common base class for DOLFIN variables.
Definition: Variable.h:35
~MultiMesh()
Destructor.
Definition: MultiMesh.cpp:102
std::shared_ptr< const BoundingBoxTree > bounding_box_tree(std::size_t part) const
Definition: MultiMesh.cpp:236
bool is_built() const
Check whether multimesh has been built.
Definition: MultiMesh.h:354
std::pair< std::vector< double >, std::vector< double > > quadrature_rule
Structure storing a quadrature rule.
Definition: MultiMesh.h:55
void add(std::string key)
Definition: Parameters.h:128
Definition: MultiMesh.h:50
const std::map< unsigned int, quadrature_rule > & quadrature_rules_cut_cells(std::size_t part) const
Definition: MultiMesh.cpp:180
const std::vector< unsigned int > cut_cells(std::size_t part) const
Definition: MultiMesh.cpp:126
std::shared_ptr< const BoundingBoxTree > bounding_box_tree_boundary(std::size_t part) const
Definition: MultiMesh.cpp:243
std::string plot_matplotlib(double delta_z=1, const std::string &filename="") const
Create matplotlib string to plot 2D multimesh (small meshes only)
Definition: MultiMesh.cpp:383
const std::vector< unsigned int > & covered_cells(std::size_t part) const
Definition: MultiMesh.cpp:146
std::shared_ptr< const Mesh > part(std::size_t i) const
Definition: MultiMesh.cpp:112
double compute_area() const
Definition: MultiMesh.cpp:307
std::vector< Point > Simplex
A simplex is a list of points.
Definition: MultiMesh.h:58
const std::vector< unsigned int > & uncut_cells(std::size_t part) const
Definition: MultiMesh.cpp:119
const std::map< unsigned int, std::vector< std::pair< std::size_t, unsigned int > > > & collision_map_cut_cells(std::size_t part) const
Definition: MultiMesh.cpp:173
A Cell is a MeshEntity of topological codimension 0.
Definition: Cell.h:42
std::size_t num_parts() const
Definition: MultiMesh.cpp:107
const std::map< unsigned int, std::vector< quadrature_rule > > & quadrature_rules_interface(std::size_t part) const
Definition: MultiMesh.cpp:213
Definition: Parameters.h:94
std::pair< std::vector< Simplex >, std::set< std::size_t > > Polyhedron
A polyhedron is a list of simplices and the part numbers.
Definition: MultiMesh.h:61
MultiMesh()
Create empty multimesh.
Definition: MultiMesh.cpp:45
This class defines quadrature rules for simplices.
Definition: SimplexQuadrature.h:36
void auto_cover(std::size_t p, const Point &point)
Definition: MultiMesh.cpp:457
std::vector< std::size_t > IncExcKey
Key to identify polyhedra.
Definition: MultiMesh.h:64
double compute_volume() const
Corresponding function for volume.
Definition: MultiMesh.cpp:350
const std::map< unsigned int, std::vector< quadrature_rule > > & quadrature_rules_overlap(std::size_t part) const
Definition: MultiMesh.cpp:197
const std::map< unsigned int, std::vector< std::vector< double > > > & facet_normals(std::size_t part) const
Definition: MultiMesh.cpp:229
void clear()
Clear multimesh.
Definition: MultiMesh.cpp:294
void add(std::shared_ptr< const Mesh > mesh)
Definition: MultiMesh.cpp:249
void build(std::size_t quadrature_order=2)
Build multimesh.
Definition: MultiMesh.cpp:256
static Parameters default_parameters()
Default parameter values.
Definition: MultiMesh.h:360