Flow123d  jenkins-Flow123d-linux-release-multijob-282
mh_dofhandler.cc
Go to the documentation of this file.
1 /*
2  * mh_dofhandler.cc
3  *
4  * Created on: Jun 18, 2012
5  * Author: jb
6  */
7 
8 #include "flow/mh_dofhandler.hh"
9 #include "mesh/mesh.h"
10 #include "mesh/side_impl.hh"
11 
13  elem_side_to_global.resize(mesh->n_elements() );
14  FOR_ELEMENTS(mesh, ele) elem_side_to_global[ele.index()].resize(ele->n_sides());
15 
16  unsigned int i_side_global=0;
17  FOR_ELEMENTS(mesh, ele) {
18  for(unsigned int i_lside=0; i_lside < ele->n_sides(); i_lside++)
19  elem_side_to_global[ele.index()][i_lside] = i_side_global++;
20  }
21 }
22 
23 
24 unsigned int MH_DofHandler::side_dof(const SideIter side) const {
25  return elem_side_to_global[ side->element().index() ][ side->el_idx() ];
26 }
27 
28 
29 void MH_DofHandler::set_solution( double time, double * solution, double precision) {
30  ASSERT( solution != NULL, "Empty solution.\n");
31  mh_solution = solution;
33  time_ = time;
34 }
35 
36 /// temporary replacement for DofHandler accessor, flux through given side
37 double MH_DofHandler::side_flux(const Side &side) const {
38  return mh_solution[ elem_side_to_global[ side.element().index() ][ side.el_idx() ] ];
39 }
40 
41 /// temporary replacement for DofHandler accessor, scalar (pressure) on edge of the side
42 double MH_DofHandler::side_scalar(const Side &side) const {
43  unsigned int i_edg = side.edge_idx();
44  return mh_solution[ side.mesh()->n_sides() + side.mesh()->n_elements() + i_edg ];
45 }
46 
47 
49  return mh_solution[ ele->mesh_->n_sides() + ele.index() ];
50 }
Definition: sides.h:43
void reinit(Mesh *mesh)
#define FOR_ELEMENTS(_mesh_, __i)
Definition: mesh.h:364
unsigned int edge_idx() const
Definition: side_impl.hh:50
???
Definition: mesh.h:109
int index() const
Definition: sys_vector.hh:88
unsigned int n_sides()
Definition: mesh.cc:172
double precision() const
vector< vector< unsigned int > > elem_side_to_global
unsigned int n_elements() const
Definition: mesh.h:141
#define ASSERT(...)
Definition: global_defs.h:121
double element_scalar(ElementFullIter &ele) const
temporary replacement for DofHandler accessor, scalar (pressure) on element
unsigned int side_dof(const SideIter side) const
double side_flux(const Side &side) const
temporary replacement for DofHandler accessor, flux through given side
ElementFullIter element() const
Definition: side_impl.hh:41
unsigned int el_idx() const
Definition: side_impl.hh:70
double * mh_solution
void set_solution(double time, double *solution, double precision)
double side_scalar(const Side &side) const
temporary replacement for DofHandler accessor, scalar (pressure) on edge of the side ...
double solution_precision
Mesh * mesh() const
Definition: side_impl.hh:46