Flow123d  release_3.0.0-1166-g21aa698
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 ()
 
 ElementAccessor (const Mesh *mesh, RegionIdx r_idx)
 
 ElementAccessor (const Mesh *mesh, unsigned int idx)
 
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
 
bool is_boundary () const
 We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular mesh. More...
 
unsigned int idx () const
 Return local idx of element in boundary / bulk part of element vector. More...
 
unsigned int mesh_idx () const
 Return global idx of element in full element vector. More...
 
unsigned int index () const
 
unsigned int proc () const
 
void inc ()
 
SideIter side (const unsigned int loc_index)
 
const SideIter side (const unsigned int loc_index) const
 
const Nodenode (unsigned int ni) const
 
NodeAccessor< 3 > node_accessor (unsigned int ni) const
 
BoundingBox bounding_box () const
 
vector< arma::vec3vertex_list () const
 
double measure () const
 Computes the measure of the element. More...
 
double tetrahedron_jacobian () const
 
arma::vec::fixed< spacedim > centre () const
 Computes the barycenter. More...
 
double quality_measure_smooth (SideIter side) const
 
bool operator== (const ElementAccessor< spacedim > &other)
 
const Elementoperator-> () const
 

Private Attributes

unsigned int dim_
 Dimension of reference element. More...
 
const Meshmesh_
 Pointer to the mesh owning the element. More...
 
bool boundary_
 True if the element is boundary. More...
 
unsigned int element_idx_
 Index into Mesh::element_vec_ array. More...
 
RegionIdx r_idx_
 Region index. More...
 

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 31 of file dh_cell_accessor.hh.

Constructor & Destructor Documentation

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

Default invalid accessor.

Definition at line 55 of file accessors.hh.

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

Regional accessor.

Definition at line 62 of file accessors.hh.

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

Element accessor.

Definition at line 69 of file accessors.hh.

Member Function Documentation

template<int spacedim>
BoundingBox ElementAccessor< spacedim >::bounding_box ( ) const
inline

Return bounding box of the element. Simpler code, but need to check performance penelty.

Definition at line 157 of file accessors.hh.

Here is the caller graph for this function:

template<int spacedim>
arma::vec::fixed< spacedim > ElementAccessor< spacedim >::centre ( ) const

Computes the barycenter.

SET THE "CENTRE[]" FIELD IN STRUCT ELEMENT

Definition at line 285 of file accessors.hh.

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

Definition at line 87 of file accessors.hh.

Here is the caller graph for this function:

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

Definition at line 90 of file accessors.hh.

Here is the caller graph for this function:

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

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

Definition at line 111 of file accessors.hh.

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

Definition at line 129 of file accessors.hh.

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

Definition at line 121 of file accessors.hh.

Here is the caller graph for this function:

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

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

Definition at line 106 of file accessors.hh.

Here is the caller graph for this function:

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

Definition at line 79 of file accessors.hh.

Here is the caller graph for this function:

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

Definition at line 75 of file accessors.hh.

Here is the caller graph for this function:

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

Definition at line 83 of file accessors.hh.

Here is the caller graph for this function:

template<int spacedim>
double ElementAccessor< spacedim >::measure ( ) const

Computes the measure of the element.

SET THE "METRICS" FIELD IN STRUCT ELEMENT

Definition at line 254 of file accessors.hh.

Here is the caller graph for this function:

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

Return global idx of element in full element vector.

Definition at line 117 of file accessors.hh.

template<int spacedim>
const Node* ElementAccessor< spacedim >::node ( unsigned int  ni) const
inline

Definition at line 145 of file accessors.hh.

Here is the caller graph for this function:

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

Definition at line 149 of file accessors.hh.

Here is the caller graph for this function:

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 215 of file accessors.hh.

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

Definition at line 200 of file accessors.hh.

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

Definition at line 125 of file accessors.hh.

Here is the caller graph for this function:

template<int spacedim>
double ElementAccessor< spacedim >::quality_measure_smooth ( SideIter  side) const

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.

Definition at line 301 of file accessors.hh.

Here is the caller graph for this function:

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

Definition at line 95 of file accessors.hh.

Here is the caller graph for this function:

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

Definition at line 98 of file accessors.hh.

Here is the caller graph for this function:

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

Definition at line 137 of file accessors.hh.

Here is the caller graph for this function:

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

Definition at line 141 of file accessors.hh.

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

Computes the Jacobian of the element. J = det ( 1 1 1 1 ) x1 x2 x3 x4 y1 y2 y3 y4 z1 z2 z3 z4

Definition at line 179 of file accessors.hh.

Here is the caller graph for this function:

template<int spacedim>
vector<arma::vec3> ElementAccessor< spacedim >::vertex_list ( ) const
inline

Return list of element vertices.

Definition at line 164 of file accessors.hh.

Here is the caller graph for this function:

Member Data Documentation

template<int spacedim>
bool ElementAccessor< spacedim >::boundary_
private

True if the element is boundary.

Definition at line 233 of file accessors.hh.

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

Dimension of reference element.

Definition at line 228 of file accessors.hh.

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

Index into Mesh::element_vec_ array.

Definition at line 236 of file accessors.hh.

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

Pointer to the mesh owning the element.

Definition at line 231 of file accessors.hh.

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

Region index.

Definition at line 239 of file accessors.hh.

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 225 of file accessors.hh.


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