Flow123d  master-3768d5dec
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
ElementAccessor< spacedim > Class Template Reference

#include <dh_cell_accessor.hh>

Collaboration diagram for ElementAccessor< spacedim >:
Collaboration graph
[legend]

Public Member Functions

 ElementAccessor ()
 Default invalid accessor. More...
 
 ElementAccessor (const MeshBase *mesh, RegionIdx r_idx)
 Regional accessor. More...
 
 ElementAccessor (const MeshBase *mesh, unsigned int idx)
 Element accessor. More...
 
void inc ()
 Incremental function of the Element iterator. More...
 
double measure () const
 Computes the measure of the element. More...
 
bool inverted () const
 
double sign () const
 
double jacobian_S3 () const
 
double jacobian_S2 () const
 
double jacobian_S1 () const
 
arma::vec::fixed< spacedim > centre () const
 Computes the barycenter. More...
 
double quality_measure_smooth () const
 
SideIter side (const unsigned int loc_index)
 
const SideIter side (const unsigned int loc_index) const
 
bool is_regional () const
 
bool is_elemental () const
 
bool is_valid () const
 
unsigned int dim () const
 
const Elementelement () const
 
Region region () const
 
RegionIdx region_idx () const
 
unsigned int idx () const
 We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular mesh. More...
 
unsigned int input_id () const
 Return the element ID in the input mesh. Should be only used for special output. More...
 
unsigned int proc () const
 
NodeAccessor< 3 > node (unsigned int ni) const
 
BoundingBox bounding_box () const
 
auto & orig_nodes_order () const
 
bool operator== (const ElementAccessor< spacedim > &other) const
 
bool operator!= (const ElementAccessor< spacedim > &other) const
 
const Elementoperator-> () const
 

Private Attributes

const MeshBasemesh_
 Pointer to the mesh owning the element. More...
 
unsigned int element_idx_
 Index into Mesh::element_vec_ array. More...
 
RegionIdx r_idx_
 

Static Private Attributes

static const unsigned int undefined_dim_ = 100
 

Detailed Description

template<int spacedim>
class ElementAccessor< spacedim >

Element accessor templated just by dimension of the embedding space, used by Fields. This should allow algorithms over elements where dimension of particular element is runtime parameter.

This class suites as interface of Fields to the mesh elements, in particular this accessor knows directly the region, and also can be used as an accessor that works on the whole region if used by Fields that do not depend on particular elements as FieldConstant, FiledFormula, and FieldPython.

TODO:

Ideas: need function to calculate intersection (object) of two ElementAccessors, but this definitely should be templated by dimension of the ref. element (or rather shape of ref. element), here we can have case dispatch

Navrh algoritmu pro hledani pruniku elementu dvou siti (libovlnych dimenzi) algoritmus postupuje od bodu pruniku pres usecky a polygony k mnohostenum

Vstup: Sit1 dimenze d1 a Sit2 dimenze d2 predpoladam d1<=d2

1) hladam body na hranici pruniku tj. Intersection<d> <d_e1,d_e2> .. prunik ma dimenzi d a pronikaji se simplexy dimenze d_e1, a d_e2

Intersection<0><0,0> .. totozne vrcholy El<0> Intersection<0><0,1> a <1,0> .. vrchol jedne site lezi na hrane druhe site Intersection<0><0,n> a <n,0> .. vrchol lezi na El<n> druhe site

Intersection<0><1,1> .. bodovy prusecik dvou usecek v rovine Intersection<0><1,2> a <2,1> ... prusecik hrany a trojuhelnika ... dalsi zvlastni pripady vcetne <0><3,3> .. tetrahedrony s vrcholem na povrchu druheho

2) liniove pruniky Intersection<1>: Intersection<1><1,1> .. usecky na spolecne primce Intersection<1><1,2> a <2,1>.. usecka v rovine trojuhelnika Intersection<1><1,3> a <3,1> .. usecka a tetrahedron Intersection<1><2,2> .. prusecik dvou trojuhelniku Intersection<1><2,3> a <3,2> .. trojuhelnik a hrana tetrahedronu ..

... doprcic je to fakt hodne moznosti a je otazka, zda je nutne je vsechny rozlisovat

Algoritmus by mel probuhat takto:

1) Najdu vrchol V site 1 a element E site 2 aby V byl v E (to neni tak trivialni, pokud site nepokryvaji stejnou oblast ale snad by to slo hledat v pruniku obalovych boxu) 2) najdu pruseciky P_i hran z vrcholu V s povrchem E, konstruuju vsechny potrebne pruniky elementu majici vrchol V s elementem E

Sousedni elementy spolu s hranami ktere do nich vedou ulozim do prioritni fronty.

3) Vyberu z prioritni fronty novy E, pricemz vyuzivam spositane pruseciky psislusne steny a okoli vrcholu V tj. jdu po hranach po kterych jsem do noveho lementu prisel a najdu vsechny hranove pruniky, pak konstuuju slozitejsi pruniky az mam vsechny pruniky s novym elementem ...

...

Prioritni fronta by preferovala elementy do kterych jsem se nejvicekrat dostal, tim se snazim minimalizovat povrch projite oblasti. Je ale mozne, ze to algoritmus naopak zpomali, pokud je prioritni fronta log(n).

Zpracovani jednoho elementu tedy zahrnuje 1) trasovani hran: pro hranu H: testuju hledam prusecik se ctyrstenem: ANO -> pamatuju si hranovy prunik a ke stene (resp. sousednimu elementu) kde hrana vychazi pridam vychozi hranu NE -> konci ve vrcholu, dalsi hrany vychazejici z vrcholu pridam na seznam hran vchazejicich do elementu

2) po nalezeni pruniku vsech hran, hledam pruniky vsech vchazejicich ploch: jedna plocha ma se vstupni stenou useckovy prunik na jehoz konci jsou: *vstupni hrana

3) Podobne trasuju vchazejici objemy

?? lze nejak vyuzit pokud ma element vice vstupnich sten minimalne se da kontrolovat ...

Struktura systemu pruniku do budoucna: 1) trida IntersectionManager, ma matici vektoru. Na poli A(i,j) je vektor lokalnich souradnic na elementu dimenze i (chodi od 1 do 3) pruniku dimenze j (chodi od 0 do 3 resp do 2 pokud nebudu chtit prekryvy siti stejne dimenze)

2) Jeden intersection objekt je pak iterator dvou elementu a dva indexy lokalnich souradnic v prislusnych vektorech.

Prozatim to zjednodusime tak, ze vektory lokalnich souradnic budu alokovat zvlast a nebudu je zdruzovat

Nakonec potrebuju pocitat integral pres prunik z nejake funkce f(phi_a(x), phi_b(x)), kde phi_a je bazova funkce na jednom elementu a phi_b na druhem. To budu delat numerickou kvadraturou, takze potrebuji zobrazit prunik na jednotkovy simplex. Pro uzel kvardatury x_i musim najit body a_i a b_i na referencnich elementech A a B. Tj potrebuju lokalni souradnice (to jsou souradnice na referencnich elementech) kvadraturnich bodu. V nic pak umim spocitat hodnotu bazovych funkci a pak i hodnotu funkce f.

K tomu staci mit matici transformace pruniku na referencni element. Takze bych pro jednotlive dvojice element - prunik mel matici + posouvaci vektor z armadila.

Definition at line 32 of file dh_cell_accessor.hh.

Constructor & Destructor Documentation

◆ ElementAccessor() [1/3]

template<int spacedim>
ElementAccessor< spacedim >::ElementAccessor
inline

Default invalid accessor.

Default invalid accessor.

Definition at line 25 of file accessors_impl.hh.

◆ ElementAccessor() [2/3]

template<int spacedim>
ElementAccessor< spacedim >::ElementAccessor ( const MeshBase mesh,
RegionIdx  r_idx 
)
inline

Regional accessor.

Regional accessor.

Definition at line 33 of file accessors_impl.hh.

◆ ElementAccessor() [3/3]

template<int spacedim>
ElementAccessor< spacedim >::ElementAccessor ( const MeshBase mesh,
unsigned int  idx 
)
inline

Element accessor.

Element accessor.

Definition at line 43 of file accessors_impl.hh.

Member Function Documentation

◆ bounding_box()

template<int spacedim>
BoundingBox ElementAccessor< spacedim >::bounding_box
inline

Return bounding box of the element.

Definition at line 142 of file accessors_impl.hh.

Here is the caller graph for this function:

◆ centre()

template<int spacedim>
arma::vec::fixed< spacedim > ElementAccessor< spacedim >::centre
inline

Computes the barycenter.

SET THE "CENTRE[]" FIELD IN STRUCT ELEMENT

Definition at line 81 of file accessors_impl.hh.

Here is the caller graph for this function:

◆ dim()

template<int spacedim>
unsigned int ElementAccessor< spacedim >::dim ( ) const
inline

Definition at line 188 of file accessors.hh.

◆ element()

template<int spacedim>
const Element* ElementAccessor< spacedim >::element ( ) const
inline

Definition at line 193 of file accessors.hh.

Here is the caller graph for this function:

◆ idx()

template<int spacedim>
unsigned int ElementAccessor< spacedim >::idx ( ) const
inline

We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular mesh.

Return local idx of element in boundary / bulk part of element vector

Definition at line 215 of file accessors.hh.

◆ inc()

template<int spacedim>
void ElementAccessor< spacedim >::inc
inline

Incremental function of the Element iterator.

Definition at line 49 of file accessors_impl.hh.

◆ input_id()

template<int spacedim>
unsigned int ElementAccessor< spacedim >::input_id ( ) const
inline

Return the element ID in the input mesh. Should be only used for special output.

Definition at line 220 of file accessors.hh.

Here is the caller graph for this function:

◆ inverted()

template<int spacedim>
bool ElementAccessor< spacedim >::inverted ( ) const
inline

Definition at line 117 of file accessors.hh.

Here is the caller graph for this function:

◆ is_elemental()

template<int spacedim>
bool ElementAccessor< spacedim >::is_elemental ( ) const
inline

Definition at line 180 of file accessors.hh.

Here is the caller graph for this function:

◆ is_regional()

template<int spacedim>
bool ElementAccessor< spacedim >::is_regional ( ) const
inline

Definition at line 176 of file accessors.hh.

Here is the caller graph for this function:

◆ is_valid()

template<int spacedim>
bool ElementAccessor< spacedim >::is_valid ( ) const
inline

Definition at line 184 of file accessors.hh.

Here is the caller graph for this function:

◆ jacobian_S1()

template<int spacedim>
double ElementAccessor< spacedim >::jacobian_S1 ( ) const
inline

Returns Jacobian of 1D element.

Definition at line 151 of file accessors.hh.

◆ jacobian_S2()

template<int spacedim>
double ElementAccessor< spacedim >::jacobian_S2 ( ) const
inline

Returns Jacobian of 2D element.

Definition at line 140 of file accessors.hh.

◆ jacobian_S3()

template<int spacedim>
double ElementAccessor< spacedim >::jacobian_S3 ( ) const
inline

Returns Jacobian of 3D element. Used by measure and in intersections.

Definition at line 129 of file accessors.hh.

Here is the caller graph for this function:

◆ measure()

template<int spacedim>
double ElementAccessor< spacedim >::measure
inline

Computes the measure of the element.

SET THE "METRICS" FIELD IN STRUCT ELEMENT

Definition at line 59 of file accessors_impl.hh.

Here is the caller graph for this function:

◆ node()

template<int spacedim>
NodeAccessor<3> ElementAccessor< spacedim >::node ( unsigned int  ni) const
inline

Definition at line 230 of file accessors.hh.

Here is the caller graph for this function:

◆ operator!=()

template<int spacedim>
bool ElementAccessor< spacedim >::operator!= ( const ElementAccessor< spacedim > &  other) const
inline

Definition at line 248 of file accessors.hh.

◆ operator->()

template<int spacedim>
const Element* ElementAccessor< spacedim >::operator-> ( ) const
inline
  -> dereference operator

  Allow simplify calling of element() method. Example:
ElementAccessor<3> elm_ac(mesh, index);
centre = elm_ac.element()->node_idx(0); // full format of access to element
centre = elm_ac->node_idx(0); // short format with dereference operator

Definition at line 263 of file accessors.hh.

◆ operator==()

template<int spacedim>
bool ElementAccessor< spacedim >::operator== ( const ElementAccessor< spacedim > &  other) const
inline

Definition at line 244 of file accessors.hh.

◆ orig_nodes_order()

template<int spacedim>
auto& ElementAccessor< spacedim >::orig_nodes_order ( ) const
inline

Definition at line 240 of file accessors.hh.

Here is the caller graph for this function:

◆ proc()

template<int spacedim>
unsigned int ElementAccessor< spacedim >::proc ( ) const
inline

Definition at line 224 of file accessors.hh.

Here is the caller graph for this function:

◆ quality_measure_smooth()

template<int spacedim>
double ElementAccessor< spacedim >::quality_measure_smooth
inline

Quality of the element based on the smooth and scale-invariant quality measures proposed in: J. R. Schewchuk: What is a Good Linear Element?

We scale the measure so that is gives value 1 for regular elements. Line 1d elements have always quality 1.

We return signed value in order to detect inverted elements.

Definition at line 97 of file accessors_impl.hh.

◆ region()

template<int spacedim>
Region ElementAccessor< spacedim >::region ( ) const
inline

Definition at line 198 of file accessors.hh.

Here is the caller graph for this function:

◆ region_idx()

template<int spacedim>
RegionIdx ElementAccessor< spacedim >::region_idx ( ) const
inline

Definition at line 201 of file accessors.hh.

Here is the caller graph for this function:

◆ side() [1/2]

template<int spacedim>
SideIter ElementAccessor< spacedim >::side ( const unsigned int  loc_index)
inline

Definition at line 131 of file accessors_impl.hh.

Here is the caller graph for this function:

◆ side() [2/2]

template<int spacedim>
const SideIter ElementAccessor< spacedim >::side ( const unsigned int  loc_index) const
inline

Definition at line 136 of file accessors_impl.hh.

◆ sign()

template<int spacedim>
double ElementAccessor< spacedim >::sign ( ) const
inline

Definition at line 121 of file accessors.hh.

Here is the caller graph for this function:

Member Data Documentation

◆ element_idx_

template<int spacedim>
unsigned int ElementAccessor< spacedim >::element_idx_
private

Index into Mesh::element_vec_ array.

Definition at line 279 of file accessors.hh.

◆ mesh_

template<int spacedim>
const MeshBase* ElementAccessor< spacedim >::mesh_
private

Pointer to the mesh owning the element.

Definition at line 276 of file accessors.hh.

◆ r_idx_

template<int spacedim>
RegionIdx ElementAccessor< spacedim >::r_idx_
private

Definition at line 283 of file accessors.hh.

◆ undefined_dim_

template<int spacedim>
const unsigned int ElementAccessor< spacedim >::undefined_dim_ = 100
staticprivate

When dim_ == undefined_dim_ ; the value of element_idx_ is invalid. Is used for ElementAccessors for whole region

Definition at line 273 of file accessors.hh.


The documentation for this class was generated from the following files:
Armor::vec
ArmaVec< double, N > vec
Definition: armor.hh:885
ElementAccessor< 3 >
ElementAccessor::centre
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
Definition: accessors_impl.hh:81