HIFLOW  2.0
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
hiflow Namespace Reference

Matrix and Vector Initialization function. More...

Namespaces

 AMG
 
 doffem
 
 la
 
 mesh
 
 polynomialchaos
 

Classes

class  ArmijoDamping
 Base class for damping strategies. More...
 
class  AssemblyAlgorithmBase
 Basic services for the implementation of an assembly algorithm. More...
 
class  AssemblyAssistant
 Helper class for local assembly and integration functors. More...
 
class  BBox
 A simple rectangular box in any dimension. More...
 
struct  BoundaryAssemblyAlgorithm
 Generic assembly algorithm for global assembly on the interior of the mesh. More...
 
class  BSphere
 A simple sphere in any dimension. More...
 
class  CellVisualization
 Visualization of finite element solutions. More...
 
class  CellVisualizationGrids
 Description of a square 2d grid or cubic 3d grid. More...
 
struct  CmpPairs
 Structure for sorting values and get the corresponding permutation. To achieve this, the comparison for two indices is performed on the corresponding values. More...
 
class  CustomQuadratureType
 QuadratureType where user can set the points and weights arbitrarily. More...
 
class  DampingStrategy
 Base class for damping strategies. More...
 
struct  DefaultFacetQuadratureSelection
 The default facet quadrature selection chooses a facet quadrature rule that is accurate to 2 * max(fe_degree). More...
 
struct  DefaultInterfaceQuadratureSelection
 
class  DefaultQuadratureCreator
 Concrete creator for quadratures in HiFlow. More...
 
struct  DefaultQuadratureSelection
 The default quadrature selection chooses a quadrature rule that is accurate to 3 * max(fe_degree). More...
 
class  DGAssemblyAssistant
 Provides assembly functionalities needed for DG, i.e., local assembly over interfaces where function values are needed from several adjacent cells. More...
 
class  DGGlobalAssembler
 Class for performing global assembly over interfaces for e.g. Discontinuous Galerkin-Methods. More...
 
class  DynamicMeshHandler
 Class that manages mesh transfer operations in a time stepping loop. More...
 
class  DynamicMeshProblem
 base class for problems involvoing a mesh that changes during a time loop More...
 
class  Element
 Class representing one element of a finite element space. More...
 
struct  ElementCmp
 do not base ordering only on first variable. More...
 
class  EvalCellTransformationHessian
 Function that evaluates the hessians of the cell transformation. More...
 
class  EvalDerivativeFeFunction
 
struct  EvalDeterminant
 Computes the determinant of a set of matrices. More...
 
class  EvalFeFunction
 
class  EvalFeFunction2
 
class  EvalFiniteElementFunction
 Evaluates a finite element function defined through the values of its degrees of freedoms for different sets of shape function values, typically corresponding to different points. More...
 
class  EvalFiniteElementFunctionGradient
 Evaluates the gradient of a finite element function defined through the values of its degrees of freedoms for different sets of shape function values, typically corresponding to different points. More...
 
class  EvalFiniteElementFunctionHessian
 Evaluates the hessian of a finite element function defined through the values of its degrees of freedoms for different sets of shape function values, typically corresponding to different points. More...
 
class  EvalHMappedGradients
 Function that evaluates H-mapped gradients. More...
 
struct  EvalInvTranspose
 Computes the inverse transpose of a set of matrices. More...
 
class  EvalMappedNormal
 Maps a normal of a reference element to the physical element. More...
 
class  EvalMappedShapeFunctionGradients
 Function for computing mapped shape function gradients. More...
 
class  EvalMappedShapeFunctionHessians
 Function for computing mapped shape function hessians. More...
 
class  EvalPhysicalJacobian
 Computes the jacobian of the element transformation at a set of points on the reference element. More...
 
class  EvalPhysicalPoint
 Computes the coordinates of a set of points on the physical element. More...
 
struct  EvalRightMatrixMult
 Multiplies matrices on the right with a given matrix. More...
 
class  EvalShapeFunctionGradients
 Function that evaluates shape function gradients. More...
 
class  EvalShapeFunctionHessians
 Function that evaluates shape function hessians. More...
 
class  EvalShapeFunctions
 Function that evaluates shape functions. More...
 
struct  EvalSurfaceElement
 Evaluate surface element. More...
 
class  EWForcing
 Eisenstat and Walker computation of forcing terms. More...
 
class  FacetVisualization
 Visualization of finite element solutions. More...
 
class  FEInterpolation
 abstract base class for interpolating FE functions from one space to another one More...
 
class  FEInterpolationLagrange
 class for interpolating Lagrange FE functions from one space to another one interpolation works in the following way: given u_f (x) = a_i (x) V_f (from_space) compute u_t (x) = b_j (x) V_t (to_space) such that u_t(x_j) = u_f(x_j) for all dof positions x_j (t-> to_space) with (x_j) = delta_{kj} More...
 
class  FixPointSolver
 Place holder for future fixpoint solvers, not requiring a jacobian. More...
 
class  ForcingStrategy
 Base class for forcing strategies. More...
 
class  FunctionValues
 Evaluation and storage of function values. More...
 
class  GlobalAssembler
 Abstract interface for classes implementing a Global Assembly strategy. More...
 
class  GoalFunctional
 
class  GoalFunctionalVariableSubDomain
 
class  Grid
 Description of a regular 2d or 3d grid. More...
 
struct  GridData
 
class  HexahedralQuadratureMapping
 
class  HierarchicalReport
 
class  HpFemAssembler
 hp-FEM Global Assembly strategy More...
 
class  HpMatrixAssembly
 
class  HpVectorAssembly
 
class  InteriorAssemblyAlgorithm
 Generic assembly algorithm for global assembly on the interior of the mesh. More...
 
class  IOAssistant
 
class  IterateControl
 Class for test on convergence of iterative methods. More...
 
class  LagrangeCoeff
 
class  LagrangePolynomial
 
class  LegAnsatzPolynomial
 
class  Log
 Class managing a collection of log entries. More...
 
class  LogEntry
 Class representing a single entry in a log. For internal use by the class Log. More...
 
class  LogKeeper
 Singleton class for managing Log objects. More...
 
class  MappedQuadratureType
 
class  Mat
 Class representing a floating-point matrix with M rows and N columns. More...
 
class  Mat< 0, N, DataType >
 
class  Mat< M, 0, DataType >
 
class  Newton
 Newton nonlinear solver. More...
 
class  Newtoncreator
 Newton creator class. More...
 
class  NonlinearProblem
 Newton nonlinear solver. More...
 
class  NonlinearProblemFromApp
 Simplification, waiting for final integration routine. More...
 
class  NonlinearSolver
 Base class for all nonlinear solvers in HiFlow. More...
 
class  NonlinearSolverCreator
 Creator base class for linear solvers in HiFlow. More...
 
class  NonlinearSolverFactory
 Factory for nonlinear solvers in HiFlow. More...
 
class  ParallelCellVisualization
 Writer for Pvtk files. More...
 
class  ParallelFacetVisualization
 Writer for Pvtk files. More...
 
struct  ParametersEvalType
 
struct  ParametersFinalType
 
struct  ParametersForceType
 
class  PeriodicBoundaryConditions
 Handling of periodic boundary conditions. More...
 
class  PeriodicBoundaryConditionsCartesian
 Handling of periodic boundary conditions in case of boundaries orthogonal to cartesian axes. More...
 
class  PointEvaluator
 Evaluates a Function in one point with help of the GridGeometricSearch. More...
 
class  PolyCoeff
 
class  PropertyTree
 Describes a tree of properties, i.e a hierarchical collection of key-value pairs. The keys are of type std::string, and the values of the template parameter type ValueType. ValueType must be default-constructible. More...
 
class  PyramidQuadratureMapping
 
class  Quadrature
 Holds all necessary information about the desired quadrature rule and is templated by a DataType (e.g. double) More...
 
class  QuadratureCreator
 Creator base class for quadratures in HiFlow. More...
 
class  QuadratureEconomicalGaussHexahedron
 
class  QuadratureEconomicalGaussQuadrilateral
 
class  QuadratureFactory
 Factory for quadratures in HiFlow. More...
 
class  QuadratureGaussHexahedron
 Derived class of all gaussian quadratures on hexahedrons which is templated by a DataType (e.g. double) More...
 
class  QuadratureGaussLine
 Derived class of all gaussian quadratures on lines which is templated by a DataType (e.g. double) More...
 
class  QuadratureGaussPyramid
 
class  QuadratureGaussQuadrilateral
 Derived class of all gaussian quadratures on quadrilaterals which is templated by a DataType (e.g. double) More...
 
class  QuadratureGaussTetrahedron
 Derived class of all gaussian quadratures on tetrahedrons which is templated by a DataType (e.g. double) More...
 
class  QuadratureGaussTriangle
 Derived class of all gaussian quadratures on triangles which is templated by a DataType (e.g. double) More...
 
class  QuadratureMapping
 
class  QuadratureType
 Ancestor class of all implemented quadrature types which is templated by a DataType (e.g. double) More...
 
class  QuadrilateralQuadratureMapping
 
struct  ScopedArray
 Include scoped_array template from boost. More...
 
struct  ScopedPtr
 Include scoped_ptr template from boost. More...
 
class  ScopedTimer
 
struct  SharedPtr
 Include shared_ptr from std::tr1. More...
 
struct  Solution
 
class  SortedArray
 Array of sorted elements. More...
 
class  SpacePatchInterpolation
 class for interpolating FE functions from one space to another one with a coarser mesh and higher polynomial degree More...
 
struct  SparsityStructure
 
class  StandardBoundaryScalarAssembly
 
class  StandardGlobalAssembler
 Standard Global Assembly strategy. More...
 
class  StandardMatrixAssembly
 
class  StandardMultipleScalarAssembly
 
class  StandardScalarAssembly
 
class  StandardVectorAssembly
 
class  Table
 
class  TableColumn
 
class  Tensor
 
class  TensorIndex
 
class  TetrahedralQuadratureMapping
 
class  TimeMesh
 Sequential, 1D mesh used for time discretization. More...
 
class  TimePatchInterpolation
 class for evaluating Time-FE functions with degree <= 1 on time interval patch [t_{n-1}, t_n] [t_n, t_{n+1}] More...
 
class  Timer
 
class  TriangleQuadratureMapping
 
class  Vec
 Class representing a floating-point vector of size N. More...
 
struct  VectorMapCmp
 
class  VectorSpace
 Solution structure which represents a vector and its space. More...
 
class  Visualization
 Visualization of finite element functions, f.e. solutions vectors. More...
 
struct  XdmfAttribute
 
struct  XdmfBaseItem
 
struct  XdmfCoordinate
 
struct  XdmfDataItem
 
struct  XdmfFunction
 
struct  XdmfGeometry
 
struct  XdmfTopology
 
class  XdmfVisualization
 

Typedefs

typedef std::vector< std::pair< int, double > >::const_iterator ConstraintIterator
 

Enumerations

enum  ArmijoParam {
  ArmijoInitial, ArmijoMinimal, ArmijoMaxLoop, ArmijoDecrease,
  ArmijoSuffDec
}
 Enumerator ArmijoParam User changable. More...
 
enum  DampingState { kDampingSuccess = 0, kDampingExceeded, kDampingError }
 Enumerator DampingState as return value for the update function. More...
 
enum  LogCategory { LOG_DEBUG_TAG, LOG_INFO_TAG, LOG_WARNING_TAG, LOG_ERROR_TAG }
 Available categories for log messages. More...
 
enum  NonlinearSolverState { kNonlinearSolverSuccess = 0, kNonlinearSolverExceeded, kNonlinearSolverInitError, kNonlinearSolverError }
 Enumerator NonlinearSolverState as return value for the nonlinear solvers. More...
 

Functions

template<class T >
_horner (int deg, const PolyCoeff< T > &p, const T &x)
 
template<class T >
_lagrange_polynomial (int deg, int i, const T &x)
 _lagrange_polynomial More...
 
template<class T >
_lagrange_polynomial_x (int deg, int i, const T &x)
 _x More...
 
template<class T >
_lagrange_polynomial_xx (int deg, int i, const T &x)
 _xx More...
 
template<class T >
_legendre_polynomial (int i, const T &x)
 
template<class T >
_legendre_polynomial_x (int i, const T &x)
 
void adapt_boundary_to_function (mesh::MeshPtr mesh, const mesh::BoundaryDomainDescriptor &bdd)
 Project the boundary of a mesh onto a domain given by the BoundaryDomainDescriptor. More...
 
template<class DataType >
void add_global (const VectorSpace< DataType > &space, const std::vector< int > &row_dofs, const std::vector< int > &col_dofs, const typename GlobalAssembler< DataType >::LocalMatrix &lm, typename GlobalAssembler< DataType >::GlobalMatrix &gm)
 
template<class DataType >
void add_global (const VectorSpace< DataType > &space, const std::vector< int > &dofs, const typename GlobalAssembler< DataType >::LocalVector &lv, typename GlobalAssembler< DataType >::GlobalVector &vec)
 
template<class DirichletEvaluator , class DataType >
void compute_dirichlet_dofs_and_values (DirichletEvaluator &dirichlet_eval, const VectorSpace< DataType > &space, int var, std::vector< doffem::DofID > &dirichlet_dofs, std::vector< DataType > &dirichlet_values)
 Locate and evaluate Dirichlet boundary conditions. More...
 
MeshPtr compute_ghost_cells (const mesh::Mesh &local_mesh, const MPI_Comm &comm, mesh::SharedVertexTable &shared_verts, mesh::IMPL=mesh::IMPL_DBVIEW, int layer_width=1)
 Create new mesh containing the ghost cells from neighboring sub-domains.
CAUTION: In order to refine the mesh locally, layer_width has to be at least 2. More...
 
MeshPtr compute_ghost_cells_dbview (const mesh::Mesh &local_mesh, const MPI_Comm &comm, mesh::SharedVertexTable &shared_verts)
 Create new mesh containing the ghost cells from neighboring sub-domains. Implementation for MeshDbView. More...
 
MeshPtr compute_ghost_cells_pXest (const mesh::Mesh &local_mesh, const MPI_Comm &comm, int layer_width)
 Create new mesh containing the ghost cells from neighboring sub-domains. Implementation for MeshP4est. More...
 
template<class DataType >
void compute_hp_sparsity_structure (const VectorSpace< DataType > &space, SparsityStructure &sparsity, std::vector< std::vector< bool > > *coupling_vars)
 
void compute_sorting_permutation (const std::vector< int > &values, std::vector< int > &permutation)
 
mesh::MeshPtr create_distributed_mesh (const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, std::vector< int > &partitioning, mesh::IMPL impl)
 creates a distributed mesh from sequential master_mesh for a given partitioning More...
 
template<class DataType >
QuadratureType< DataType > * create_quadrature_type (const std::string &name)
 Factory function for quadrature types. More...
 
template<class T >
CmpPairs< T > CreateCmpPairs (const std::vector< T > &v)
 Creator function for CmpPairs. More...
 
template<class DataType >
Vec< 3, DataType > cross (const Vec< 3, DataType > &v1, const Vec< 3, DataType > &v2)
 Computes the cross product of two 3d vectors. More...
 
template<class DataType >
DataType det (const Mat< 1, 1, DataType > &m)
 
template<class DataType >
DataType det (const Mat< 2, 2, DataType > &m)
 Determinant for 2x2 matrix. More...
 
template<class DataType >
DataType det (const Mat< 3, 3, DataType > &m)
 Determinant for 3x3 matrix. More...
 
template<size_t N, class DataType >
Vec< N, DataType >::value_type dot (const Vec< N, DataType > &v1, const Vec< N, DataType > &v2)
 Computes the scalar product of two vectors. More...
 
mesh::MeshPtr extract_local_mesh (const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, std::vector< int > &partitioning, mesh::IMPL impl)
 
template<class DataType >
void find_dofs_and_coords_on_face (const mesh::EntityIterator &boundary_face, const VectorSpace< DataType > &space, int var, std::vector< doffem::DofID > &dof_ids, std::vector< std::vector< DataType > > &dof_points)
 Finds the dofs and the coords on a given (boundary) facet. More...
 
template void find_dofs_and_coords_on_face< double > (const mesh::EntityIterator &boundary_face, const VectorSpace< double > &space, int var, std::vector< doffem::DofID > &dof_ids, std::vector< std::vector< double > > &dof_points)
 
template void find_dofs_and_coords_on_face< float > (const mesh::EntityIterator &boundary_face, const VectorSpace< float > &space, int var, std::vector< doffem::DofID > &dof_ids, std::vector< std::vector< float > > &dof_points)
 
void fixed_error_strategy (double tol, int num_global_cells, double conv_order, int threshold, int coarsen_marker, const std::vector< double > &indicators, std::vector< int > &adapt_markers)
 adapt mesh to obtain a desired accuracy: refine cell k if indicator(k) > tol / num_global_cells coarsen cell k if 2^conv_order * indicator(k) < tol / num_global_cells More...
 
template<size_t N, class DataType >
DataType frob (const Mat< N, N, DataType > &m1, const Mat< N, N, DataType > &m2)
 Computes the Frobenius product of two quadratic matrices. More...
 
template<size_t M, size_t N, class DataType >
bool gauss (Mat< M, N, DataType > &mat, Vec< M, DataType > &vec)
 Gaussian elimination of a linear system. More...
 
template<class DataType >
std::vector< DataType > identity (std::vector< DataType > coord)
 
template<class DataType >
void init_master_quadrature (const Element< DataType > &slave_elem, const Element< DataType > &master_elem, const Quadrature< DataType > &slave_quad, Quadrature< DataType > &master_quad)
 
template<class DataType >
void init_traversal (const VectorSpace< DataType > &space, std::vector< int > &iteration_order)
 Initialze traversal. More...
 
template<class DataType >
void initialize_linear_algebra_objects (const VectorSpace< DataType > &space, const GlobalAssembler< DataType > &global_asm, la::Couplings< DataType > &couplings, typename GlobalAssembler< DataType >::GlobalMatrix &matrix)
 Initialize linear algebra objects for global assembly. More...
 
template<class DataType >
void InitStructure (const VectorSpace< DataType > &space, std::vector< int > *rows_diag, std::vector< int > *cols_diag, std::vector< int > *rows_offdiag, std::vector< int > *cols_offdiag, std::vector< std::vector< bool > > *coupling_vars)
 
bool interpolate_attribute (const mesh::MeshPtr parent_mesh, const std::string parent_attribute_name, mesh::MeshPtr child_mesh)
 Interpolate attribute from parent mesh to child mesh (new attributes in neighborhood are interpolated if possible by neighbor values) More...
 
template<class DataType >
void interpolate_constrained_vector (const VectorSpace< DataType > &space, typename GlobalAssembler< DataType >::GlobalVector &vector)
 
template void interpolate_constrained_vector< double > (const VectorSpace< double > &space, GlobalAssembler< double >::GlobalVector &vector)
 
template void interpolate_constrained_vector< float > (const VectorSpace< float > &space, GlobalAssembler< float >::GlobalVector &vector)
 
template<class DataType >
void inv (const Mat< 1, 1, DataType > &m, Mat< 1, 1, DataType > &m_inv)
 Inverse of 1x1 matrix. More...
 
template<class DataType >
void inv (const Mat< 2, 2, DataType > &m, Mat< 2, 2, DataType > &m_inv)
 Inverse of 2x2 matrix. More...
 
template<class DataType >
void inv (const Mat< 3, 3, DataType > &m, Mat< 3, 3, DataType > &m_inv)
 Inverse of 3x3 matrix. More...
 
template<class DataType >
void invTransp (const Mat< 1, 1, DataType > &m, Mat< 1, 1, DataType > &m_inv)
 Inverse-Transpose of 1x1 matrix. More...
 
template<class DataType >
void invTransp (const Mat< 2, 2, DataType > &m, Mat< 2, 2, DataType > &m_inv)
 Inverse-Transpose of 2x2 matrix. More...
 
template<class DataType >
void invTransp (const Mat< 3, 3, DataType > &m, Mat< 3, 3, DataType > &m_inv)
 Inverse-Transpose of 3x3 matrix. More...
 
mesh::MeshPtr load_mesh (std::string filename, const MPI_Comm &comm, mesh::IMPL impl)
 Load a mesh from a hdf5 file. More...
 
void local_fixed_fraction_strategy (double refine_frac, double coarsen_frac, int threshold, int coarsen_marker, const std::vector< double > &indicators, std::vector< int > &adapt_markers)
 set of functions for building mesh adaption flags out of local error indicators More...
 
TensorIndex< 0 > make_tensor_index ()
 
TensorIndex< 1 > make_tensor_index (int dim1)
 
TensorIndex< 2 > make_tensor_index (int dim1, int dim2)
 
TensorIndex< 3 > make_tensor_index (int dim1, int dim2, int dim3)
 
TensorIndex< 4 > make_tensor_index (int dim1, int dim2, int dim3, int dim4)
 
TensorIndex< 5 > make_tensor_index (int dim1, int dim2, int dim3, int dim4, int dim5)
 
TensorIndex< 6 > make_tensor_index (int dim1, int dim2, int dim3, int dim4, int dim5, int dim6)
 
template<class DataType >
Mat< 3, 3, DataType >::value_type matrix_minor (const Mat< 3, 3, DataType > &m, size_t i, size_t j)
 
template<size_t M, size_t N, size_t P, class DataType >
void MatrixMatrixMult (Mat< M, P, DataType > &out, const Mat< M, N, DataType > &mat1, const Mat< N, P, DataType > &mat2)
 
template<size_t N, class DataType >
Vec< N, DataType >::value_type norm (const Vec< N, DataType > &v1)
 Computes the Euclidean norm of a vector. More...
 
template<class DataType >
Vec< 2, DataType > normal (const Vec< 2, DataType > &v)
 Computes the normed normal of a 2d vector. More...
 
template<class DataType >
Vec< 3, DataType > normal (const Vec< 3, DataType > &v1, const Vec< 3, DataType > &v2)
 Computes the normed normal of two 3d vectors. More...
 
template<class DataType >
Vec< 3, DataType > normal (const Vec< 6, DataType > &v1v2)
 Computes the normed normal of two 3d vectors. More...
 
template<size_t N, class DataType >
Vec< N, DataType > operator* (const Vec< N, DataType > &v, const typename Vec< N, DataType >::value_type s)
 
template<size_t N, class DataType >
Vec< N, DataType > operator* (const typename Vec< N, DataType >::value_type s, const Vec< N, DataType > &v)
 
template<size_t M, size_t N, class DataType >
Mat< M, N, DataType > operator* (const Mat< M, N, DataType > &m, const typename Mat< M, N, DataType >::value_type s)
 
template<size_t M, size_t N, class DataType >
Mat< M, N, DataType > operator* (const typename Mat< M, N, DataType >::value_type s, const Mat< M, N, DataType > &m)
 
template<size_t M, size_t N, class DataType >
Mat< M, N, DataType > operator* (const Mat< M, N, DataType > &m1, const Mat< N, N, DataType > &m2)
 
template<size_t M, size_t N, size_t P, class DataType >
Mat< M, P, DataType > operator* (const Mat< M, N, DataType > &A, const Mat< N, P, DataType > &B)
 
template<size_t M, size_t N, class DataType >
Vec< M, DataType > operator* (const Mat< M, N, DataType > &m, const Vec< N, DataType > &v)
 
template<size_t M, size_t N, class DataType >
Vec< N, DataType > operator* (const Vec< M, DataType > &v, const Mat< M, N, DataType > &m)
 
template<size_t N, class DataType >
Vec< N, DataType > operator+ (const Vec< N, DataType > &v1, const Vec< N, DataType > &v2)
 
template<size_t M, size_t N, class DataType >
Mat< M, N, DataType > operator+ (const Mat< M, N, DataType > &m1, const Mat< M, N, DataType > &m2)
 
template<size_t N, class DataType >
Vec< N, DataType > operator- (const Vec< N, DataType > &v1, const Vec< N, DataType > &v2)
 
template<size_t M, size_t N, class DataType >
Mat< M, N, DataType > operator- (const Mat< M, N, DataType > &m1, const Mat< M, N, DataType > &m2)
 
template<size_t M, size_t N, class DataType >
Mat< M, N, DataType > operator/ (const Mat< M, N, DataType > &m, typename Mat< M, N, DataType >::value_type s)
 
std::ostream & operator<< (std::ostream &os, const Timer &timer)
 Output operator. More...
 
template<class DataType >
std::ostream & operator<< (std::ostream &s, const PeriodicBoundaryConditions< DataType > &cond)
 
template<size_t N, class DataType >
std::ostream & operator<< (std::ostream &os, const Vec< N, DataType > &v)
 Output operator for vectors. More...
 
std::ostream & operator<< (std::ostream &os, const PropertyTree &tree)
 
template<size_t M, size_t N, class DataType >
std::ostream & operator<< (std::ostream &os, const Mat< M, N, DataType > &m)
 Output operator for a general matrix. More...
 
MeshPtr partition_and_distribute (const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, int *uniform_ref_steps=NULL, mesh::IMPL impl=mesh::IMPL_DBVIEW)
 Partition and distribute mesh from one process to all processes. Uses a. More...
 
MeshPtr partition_and_distribute (const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, const mesh::GraphPartitioner *gpartitioner, int *uniform_ref_steps=NULL, mesh::IMPL impl=mesh::IMPL_DBVIEW)
 Partition and distribute mesh from one process to all processes using. More...
 
MeshPtr partition_and_distribute (const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, const mesh::MeshPartitioner *mpartitioner, int *uniform_ref_steps=NULL, mesh::IMPL impl=mesh::IMPL_DBVIEW)
 Partition and distribute mesh from one process to all processes using. More...
 
MeshPtr partition_and_distribute_dbview (const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, const mesh::GraphPartitioner *gpartitioner)
 Partition and distribute mesh from one process to all processes using. More...
 
MeshPtr partition_and_distribute_dbview (const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, const mesh::MeshPartitioner *mpartitioner)
 Partition and distribute mesh from one process to all processes using. More...
 
MeshPtr partition_and_distribute_pXest (const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, int &uniform_ref_steps)
 Partition and distribute coarse mesh. Initially, all processes contain the coarse mesh and the p4est structures p4est_t and p4est_connectivity_t. Note that p4est uses its own partitioner based on z-curves. More...
 
template<class T >
void permute_vector (const std::vector< int > &permutation, const std::vector< T > &in_values, std::vector< T > &out_values)
 Permute a vector. More...
 
template<typename Iterator >
std::string precise_string_from_range (const Iterator &begin, const Iterator &end)
 Create a high-precision string representation of a range of floating-point numbers. More...
 
template<class T >
void read_binary (std::istream &is, T &val)
 
template<class T >
void read_binary (std::istream &is, std::vector< T > &val)
 
void read_binary (std::istream &is, std::string &str)
 
MeshPtr read_mesh_from_file (const std::string &filename, mesh::TDim tdim, mesh::GDim gdim, const MPI_Comm *comm, std::vector< mesh::MasterSlave > period=std::vector< mesh::MasterSlave >(0), mesh::IMPL impl=mesh::IMPL_DBVIEW)
 Read in a mesh from a file. More...
 
mesh::MeshPtr read_partitioned_mesh (const std::string &filename, mesh::TDim tdim, mesh::GDim gdim, const MPI_Comm &comm)
 Read a mesh partitioned using the partition_mesh utility. More...
 
template<bool Timer>
void reset (ScopedTimer *timer)
 
template<>
void reset< false > (ScopedTimer *timer)
 
template<>
void reset< true > (ScopedTimer *timer)
 
void save_mesh (std::string filename, mesh::MeshPtr mesh, const MPI_Comm &comm)
 Save a mesh in a hdf5 file. More...
 
void set_default_material_number_on_bdy (mesh::MeshPtr mesh, mesh::MaterialNumber default_value=1)
 Sets a default value for the material number of all boundary facets with material number -1. Useful to distinguish between boundary facets created by the partion-process and "real"/physical boundary facets. More...
 
void set_default_material_number_on_bdy (mesh::MeshPtr mesh, mesh::MeshPtr bdy_mesh, MaterialNumber default_value)
 
template<class DataType >
Mat< 3, 3, DataType >::value_type sign (size_t i, size_t j)
 
template<class DataType >
void sort_elements (const VectorSpace< DataType > &space, std::vector< int > &iteration_order)
 Compute order of assembly, based on FEType and degree. More...
 
template<class T >
void sortingPermutation (const std::vector< T > &values, std::vector< int > &v)
 Function to get the corresponding permutation for sorting of values vector. Permutation vector is allocated inside the function. More...
 
template<bool Timer>
void start (ScopedTimer *timer)
 
template<>
void start< false > (ScopedTimer *timer)
 
template<>
void start< true > (ScopedTimer *timer)
 
template<bool Timer>
void stop (ScopedTimer *timer)
 
template<>
void stop< false > (ScopedTimer *timer)
 
template<>
void stop< true > (ScopedTimer *timer)
 
template<typename ValueType >
std::string string_from_pointer_range (const ValueType *begin, const ValueType *end)
 Create a string representation of a pointer range. More...
 
template<typename Iterator >
std::string string_from_range (const Iterator &begin, const Iterator &end)
 Create a string representation of a range. More...
 
template<size_t N, class DataType >
Vec< N, DataType >::value_type sum (const Vec< N, DataType > &v)
 Computes the sum of the vector components. More...
 
template<size_t M, class DataType >
DataType trace (const Mat< M, M, DataType > &m)
 Trace of a quadratic matrix. More...
 
template<size_t M, size_t N, class DataType >
void trans (const Mat< M, N, DataType > &m, Mat< N, M, DataType > &m_trans)
 Transpose of a general matrix. More...
 
template<class T >
T * vec2ptr (std::vector< T > &vec)
 Conversion from vector to pointer to first element. More...
 
template<class T >
const T * vec2ptr (const std::vector< T > &vec)
 Conversion from const vector to pointer to first element. More...
 
template<class T >
void write_binary (std::ostream &os, T val)
 
template<class T >
void write_binary (std::ostream &os, const std::vector< T > &vec)
 
void write_binary (std::ostream &os, const std::string &str)
 

Variables

LagrangeCoeff _lagrange_coeff1 (1, _poly_lagrange_coeff1, _poly_x_lagrange_coeff1, _poly_xx_lagrange_coeff1)
 
LagrangeCoeff _lagrange_coeff10 (10, _poly_lagrange_coeff10, _poly_x_lagrange_coeff10, _poly_xx_lagrange_coeff10)
 
LagrangeCoeff _lagrange_coeff11 (11, _poly_lagrange_coeff11, _poly_x_lagrange_coeff11, _poly_xx_lagrange_coeff11)
 
LagrangeCoeff _lagrange_coeff12 (12, _poly_lagrange_coeff12, _poly_x_lagrange_coeff12, _poly_xx_lagrange_coeff12)
 
LagrangeCoeff _lagrange_coeff13 (13, _poly_lagrange_coeff13, _poly_x_lagrange_coeff13, _poly_xx_lagrange_coeff13)
 
LagrangeCoeff _lagrange_coeff14 (14, _poly_lagrange_coeff14, _poly_x_lagrange_coeff14, _poly_xx_lagrange_coeff14)
 
LagrangeCoeff _lagrange_coeff15 (15, _poly_lagrange_coeff15, _poly_x_lagrange_coeff15, _poly_xx_lagrange_coeff15)
 
LagrangeCoeff _lagrange_coeff16 (16, _poly_lagrange_coeff16, _poly_x_lagrange_coeff16, _poly_xx_lagrange_coeff16)
 
LagrangeCoeff _lagrange_coeff17 (17, _poly_lagrange_coeff17, _poly_x_lagrange_coeff17, _poly_xx_lagrange_coeff17)
 
LagrangeCoeff _lagrange_coeff18 (18, _poly_lagrange_coeff18, _poly_x_lagrange_coeff18, _poly_xx_lagrange_coeff18)
 
LagrangeCoeff _lagrange_coeff19 (19, _poly_lagrange_coeff19, _poly_x_lagrange_coeff19, _poly_xx_lagrange_coeff19)
 
LagrangeCoeff _lagrange_coeff2 (2, _poly_lagrange_coeff2, _poly_x_lagrange_coeff2, _poly_xx_lagrange_coeff2)
 
LagrangeCoeff _lagrange_coeff20 (20, _poly_lagrange_coeff20, _poly_x_lagrange_coeff20, _poly_xx_lagrange_coeff20)
 
LagrangeCoeff _lagrange_coeff3 (3, _poly_lagrange_coeff3, _poly_x_lagrange_coeff3, _poly_xx_lagrange_coeff3)
 
LagrangeCoeff _lagrange_coeff4 (4, _poly_lagrange_coeff4, _poly_x_lagrange_coeff4, _poly_xx_lagrange_coeff4)
 
LagrangeCoeff _lagrange_coeff5 (5, _poly_lagrange_coeff5, _poly_x_lagrange_coeff5, _poly_xx_lagrange_coeff5)
 
LagrangeCoeff _lagrange_coeff6 (6, _poly_lagrange_coeff6, _poly_x_lagrange_coeff6, _poly_xx_lagrange_coeff6)
 
LagrangeCoeff _lagrange_coeff7 (7, _poly_lagrange_coeff7, _poly_x_lagrange_coeff7, _poly_xx_lagrange_coeff7)
 
LagrangeCoeff _lagrange_coeff8 (8, _poly_lagrange_coeff8, _poly_x_lagrange_coeff8, _poly_xx_lagrange_coeff8)
 
LagrangeCoeff _lagrange_coeff9 (9, _poly_lagrange_coeff9, _poly_x_lagrange_coeff9, _poly_xx_lagrange_coeff9)
 
static double _poly_lagrange_coeff1 []
 
static double _poly_lagrange_coeff10 []
 
static double _poly_lagrange_coeff11 []
 
static double _poly_lagrange_coeff12 []
 
static double _poly_lagrange_coeff13 []
 
static double _poly_lagrange_coeff14 []
 
static double _poly_lagrange_coeff15 []
 
static double _poly_lagrange_coeff16 []
 
static double _poly_lagrange_coeff17 []
 
static double _poly_lagrange_coeff18 []
 
static double _poly_lagrange_coeff19 []
 
static double _poly_lagrange_coeff2 []
 
static double _poly_lagrange_coeff20 []
 
static double _poly_lagrange_coeff3 []
 
static double _poly_lagrange_coeff4 []
 
static double _poly_lagrange_coeff5 []
 
static double _poly_lagrange_coeff6 []
 
static double _poly_lagrange_coeff7 []
 
static double _poly_lagrange_coeff8 []
 
static double _poly_lagrange_coeff9 []
 
static double _poly_x_lagrange_coeff1 []
 
static double _poly_x_lagrange_coeff10 []
 
static double _poly_x_lagrange_coeff11 []
 
static double _poly_x_lagrange_coeff12 []
 
static double _poly_x_lagrange_coeff13 []
 
static double _poly_x_lagrange_coeff14 []
 
static double _poly_x_lagrange_coeff15 []
 
static double _poly_x_lagrange_coeff16 []
 
static double _poly_x_lagrange_coeff17 []
 
static double _poly_x_lagrange_coeff18 []
 
static double _poly_x_lagrange_coeff19 []
 
static double _poly_x_lagrange_coeff2 []
 
static double _poly_x_lagrange_coeff20 []
 
static double _poly_x_lagrange_coeff3 []
 
static double _poly_x_lagrange_coeff4 []
 
static double _poly_x_lagrange_coeff5 []
 
static double _poly_x_lagrange_coeff6 []
 
static double _poly_x_lagrange_coeff7 []
 
static double _poly_x_lagrange_coeff8 []
 
static double _poly_x_lagrange_coeff9 []
 
static double _poly_xx_lagrange_coeff1 []
 
static double _poly_xx_lagrange_coeff10 []
 
static double _poly_xx_lagrange_coeff11 []
 
static double _poly_xx_lagrange_coeff12 []
 
static double _poly_xx_lagrange_coeff13 []
 
static double _poly_xx_lagrange_coeff14 []
 
static double _poly_xx_lagrange_coeff15 []
 
static double _poly_xx_lagrange_coeff16 []
 
static double _poly_xx_lagrange_coeff17 []
 
static double _poly_xx_lagrange_coeff18 []
 
static double _poly_xx_lagrange_coeff19 []
 
static double _poly_xx_lagrange_coeff2 []
 
static double _poly_xx_lagrange_coeff20 []
 
static double _poly_xx_lagrange_coeff3 []
 
static double _poly_xx_lagrange_coeff4 []
 
static double _poly_xx_lagrange_coeff5 []
 
static double _poly_xx_lagrange_coeff6 []
 
static double _poly_xx_lagrange_coeff7 []
 
static double _poly_xx_lagrange_coeff8 []
 
static double _poly_xx_lagrange_coeff9 []
 
const int DEBUG_LEVEL = 0
 

Detailed Description

Matrix and Vector Initialization function.

Visualization of facet within each cell, w.r.t. required material number.

Visualization of finite element functions.

GMRES solver for Polynomial Chaos Galerkin projected system Ax = b.

Class MasterSlave contains relevant information for periodicity.

Classes and functions related to mesh partitioning.

High-level tools for dealing with meshes.

Management of the different Platforms.

Global Platform, Implementation, Matrix Format IDs.

Author
Philipp Gerstner
Staffan Ronnas, Simon Gawlok
Staffan Ronnas, Jonathan Schwegler, Simon Gawlok
Staffan Ronnas
Chandramowli Subramanian, Simon Gawlok If defined, sparsity structure is written to structure.csv. Only meaningful in sequential mode.
Staffan Ronnas, Jonas Kratzke
Jonas Kratzke
Jonas Kratzke, Jonathan Schwegler
Hendryk Bockelmann, Chandramowli Subramanian
Jonas Latt, Jonas Fietz, Mathias Krause, Tobias Hahn
Simon Gawlok
Staffan Ronnas, Simon Gawlok
Staffan Ronnas, Thomas Gengenbach
Michael Schick
Martin Baumann
Michael Schick
Martin Baumann
Simon Gawlok
Philipp Gerstner
Philipp Gerstner
Date
2016-09-26
Author
Michael Schick
Martin Baumann
Julian Kraemer
Simon Gawlok
Michael Schick
Martin Baumann
Julian Kraemer
Chandramowli Subramanian, Nico Trost, Dimitar Lukarski, Martin Wlotzka
Carmen Straub
Chandramowli Subramanian, Martin Wlotzka
Simon Gawlok
Martin Wlotzka
Chandramowli Subramanian
Bernd Doser, HITS gGmbH
Date
2015-07-31
Author
Bernd Doser, HITS gGmbH
Date
2015-08-03
Author
Dimitar Lukarski
Dimitar Lukarski
Dimitar Lukarski

Initialize vectors and matrices on a specific platform and implementation.

Author
Dimitar Lukarski
Dimitar Lukarski

Global ID for Platform, Implementation, Matrix Format, Preconditioners System Parameter Descriptor

Author
Dimitar Lukarski, Niels Wegh
Nico Trost, Benedikt Galler, Dimitar Lukarski
Dimitar Lukarski
Dimitar Lukarski

Initialize and Stop a specific platform

Author
Bernd Doser, HITS gGmbH
Date
2015-07-23
Author
Bernd Doser, HITS gGmbH
Date
2015-08-06
Author
Simon Gawlok, Martin Wlotzka
Bernd Doser, HITS gGmbH
Date
2015-12-04
Author
Bernd Doser, HITS gGmbH
Date
2015-12-02
Author
Bernd Doser, HITS gGmbH
Date
2015-11-26
Author
Bernd Doser, HITS gGmbH
Date
2015-11-27
Author
Bernd Doser, HITS gGmbH
Date
2015-11-17
Author
Dimitar Lukarski, Nico Trost, Martin Wlotzka
Chandramowli Subramanian, Martin Wlotzka, Simon Gawlok, Volker Lange
Bernd Doser, HITS gGmbH
Date
2015-09-29
Author
Bernd Doser
Date
2015-10-12
Author
Bernd Doser, HITS gGmbH
Date
2015-10-22
Author
Bernd Doser, HITS gGmbH
Date
2015-10-07
Author
Bernd Doser, HITS gGmbH
Date
2015-10-06
Author
Bernd Doser, HITS gGmbH
Date
2015-10-20
Author
Aksel Alpay, Martin Wlotzka
Aksel Alpay
Chandramowli Subramanian, Philipp Gerstner
Tobias Hahn
Tobias Hahn, Simon Gawlok
Bernd Doser, HITS gGmbH
Date
2015-12-21
Author
Dimitar Lukarski, Nico Trost, Niels Wegh
Dimitar Lukarski, Chandramowli Subramanian
Chandramowli Subramanian, Hendryk Bockelmann
Dimitar Lukarski, Chandramowli Subramanian
Michael Schick
Thomas Gengenbach and Staffan Ronnas
Jonathan Schwegler
Jonathan Schwegler, Philipp Gerstner
Fabian Kissler, Jonathan Schwegler, Philipp Gerstner
Staffan Ronnas, Thomas Gengenbach, Jonathan Schwegler, Simon Gawlok, Philipp Gerstner
Parameters
masterMaster bound
slaveSlave bound
hcell width in vicinity of periodic bound
indexdirection of periodicity: 0 = periodicity in x-direction, 1 = periodicity in y-direction, 2 = periodicity in z-direction.

This file contains definitions of simple types used in the Mesh module. These types include integer types for e.g. entity id:s, and imported types from tr1 and boost libraries.

Author
Tobias Hahn
Michael Schick

Currently support no preconditioning and right preconditioning. Can be used with assembled matrix A or as a matrix free approach

Author
Michael Schick
Martin Baumann, Michael Schick
Martin Baumann
Code generated with program quadrature_solin_generator.
Staffan Ronnas, Martin Baumann, Teresa Beck, Simon Gawlok, Jonas Kratzke

Using this class a Vtk (http://www.vtk.org/) unstructured grid visualization file can be created. Please find detailed information about Vtk's file formats at http://www.vtk.org/VTK/img/file-formats.pdf. This type of visualization writes out every cell and with function values provided by a user-defined evaluation function.

Please note for simulations with multiple visualization calls, that this class is NOT ment to be initialized once for several visualization calls. Please construct a new instantiation of the CellVisualization every single time you want to visualize your data.

Author
Eva Ketelaer, Staffan Ronnas
Staffan Ronnas
Martin Baumann
Martin Wlotzka, Mareike Schmidtobreick
Martin Baumann, Chandramowli Subramanian, Michael Schick
Martin Baumann, Thomas Gengenbach
Jonas Kratzke, Jonathan Schwegler, Simon Gawlok, Philipp Gerstner
Bernd Doser, HITS gGmbH
Date
2015-06-15

Typedef Documentation

◆ ConstraintIterator

typedef std::vector< std::pair<int, double> >::const_iterator hiflow::ConstraintIterator

Definition at line 36 of file hp_assembly.cc.

Enumeration Type Documentation

◆ ArmijoParam

Enumerator ArmijoParam User changable.

Enumerator
ArmijoInitial 
ArmijoMinimal 
ArmijoMaxLoop 
ArmijoDecrease 
ArmijoSuffDec 

Definition at line 28 of file damping_armijo.h.

◆ DampingState

Enumerator DampingState as return value for the update function.

Enumerator
kDampingSuccess 
kDampingExceeded 
kDampingError 

Definition at line 25 of file damping_strategy.h.

◆ LogCategory

Available categories for log messages.

Enumerator
LOG_DEBUG_TAG 
LOG_INFO_TAG 
LOG_WARNING_TAG 
LOG_ERROR_TAG 

Definition at line 43 of file log.h.

◆ NonlinearSolverState

Enumerator NonlinearSolverState as return value for the nonlinear solvers.

Enumerator
kNonlinearSolverSuccess 
kNonlinearSolverExceeded 
kNonlinearSolverInitError 
kNonlinearSolverError 

Definition at line 29 of file nonlinear_solver.h.

Function Documentation

◆ _horner()

template<class T >
T hiflow::_horner ( int  deg,
const PolyCoeff< T > &  p,
const T &  x 
)

Definition at line 28 of file horner.h.

Referenced by hiflow::LagrangePolynomial< double >::poly(), hiflow::LagrangePolynomial< double >::poly_x(), and hiflow::LagrangePolynomial< double >::poly_xx().

29  {
30  // Check Input
31 
32  assert ( deg >= 0 );
33  assert ( p.size ( ) > deg );
34 
35  // Compute
36 
37  T result = p[deg];
38  for ( int k = deg; k > 0; --k )
39  {
40  result = result * x + p[k - 1];
41  }
42 
43  return result;
44  }

◆ _lagrange_polynomial()

template<class T >
T hiflow::_lagrange_polynomial ( int  deg,
int  i,
const T &  x 
)

_lagrange_polynomial

Definition at line 36 of file lagrangepolynomial.h.

Referenced by hiflow::LagrangePolynomial< double >::poly().

37  {
38  assert ( ( i >= 0 )&&( i <= deg ) );
39 
40  T r = 1.;
41  T p = ( T ) 1;
42 
43  T dx = deg*x;
44 
45  for ( int j = 0; j <= deg; ++j )
46  if ( i != j )
47  {
48  r *= ( dx - j );
49  p *= ( i - j );
50  }
51 
52  return r / p;
53  }

◆ _lagrange_polynomial_x()

template<class T >
T hiflow::_lagrange_polynomial_x ( int  deg,
int  i,
const T &  x 
)

_x

Definition at line 58 of file lagrangepolynomial.h.

Referenced by hiflow::LagrangePolynomial< double >::poly_x().

59  {
60  assert ( ( i >= 0 )&&( i <= deg ) );
61 
62  T r = 0.;
63  T p = ( T ) 1;
64  T dx = deg*x;
65 
66  for ( int j = 0; j <= deg; ++j )
67 
68  if ( i != j )
69  {
70  T s = 1.;
71 
72  for ( int k = 0; k <= deg; ++k )
73  if ( ( k != j ) && ( k != i ) )
74  s *= ( dx - k );
75 
76  r += s;
77  p *= ( i - j );
78  }
79 
80  return deg * r / p;
81  }

◆ _lagrange_polynomial_xx()

template<class T >
T hiflow::_lagrange_polynomial_xx ( int  deg,
int  i,
const T &  x 
)

_xx

Definition at line 86 of file lagrangepolynomial.h.

Referenced by hiflow::LagrangePolynomial< double >::poly_xx().

87  {
88  assert ( ( i >= 0 )&&( i <= deg ) );
89 
90  T r = 0.;
91  T p = ( T ) 1;
92  T dx = deg*x;
93 
94  for ( int j = 0; j <= deg; ++j )
95 
96  if ( i != j )
97  {
98  T s = 0.;
99 
100  for ( int k = 0; k <= deg; ++k )
101  if ( ( k != i ) && ( k != j ) )
102  {
103  T t = 1.;
104 
105  for ( int l = 0; l <= deg; ++l )
106  if ( ( l != i ) && ( l != j )&& ( l != k ) )
107  t *= ( dx - k );
108 
109  s += t;
110  }
111 
112  r += s;
113  p *= ( i - j );
114  }
115 
116  return deg * deg * r / p;
117  }

◆ _legendre_polynomial()

template<class T >
T hiflow::_legendre_polynomial ( int  i,
const T &  x 
)

Definition at line 27 of file legendrepolynomial.h.

28  {
29  if ( i == 0 )
30  return 1.;
31  else if ( i == 1 )
32  return x;
33  else return ( ( 2 * i - 1 ) * x * _legendre_polynomial<T>( i - 1, x )
34  - ( i - 1 ) * _legendre_polynomial<T>( i - 2, x ) ) / i;
35  }

◆ _legendre_polynomial_x()

template<class T >
T hiflow::_legendre_polynomial_x ( int  i,
const T &  x 
)

Definition at line 38 of file legendrepolynomial.h.

39  {
40  if ( i == 0 )
41  return 0.;
42  else if ( i == 1 )
43  return 1.;
44  else return (2 * i - 1 ) * _legendre_polynomial<T>( i - 1, x )
45  + _legendre_polynomial_x<T>( i - 2, x );
46  }

◆ adapt_boundary_to_function()

void hiflow::adapt_boundary_to_function ( mesh::MeshPtr  mesh,
const BoundaryDomainDescriptor bdd 
)

Project the boundary of a mesh onto a domain given by the BoundaryDomainDescriptor.

Definition at line 906 of file mesh_tools.cc.

References hiflow::mesh::project_point().

907  {
908  MeshPtr bdry_mesh = mesh->extract_boundary_mesh ( );
909  // go through the boundary mesh and project every point on the
910  // boundary given through the BoundaryDomainDescriptor
911  // Then replace the initial vertex with the projected vertex
912  for ( EntityIterator it = bdry_mesh->begin ( bdry_mesh->tdim ( ) );
913  it != bdry_mesh->end ( bdry_mesh->tdim ( ) );
914  ++it )
915  {
916  mesh::MaterialNumber mat = it->get_material_number ( );
917 
918  for ( IncidentEntityIterator it_vert = it->begin_incident ( 0 );
919  it_vert != it->end_incident ( 0 ); ++it_vert )
920  {
921  std::vector<Coordinate> vert ( mesh->gdim ( ) );
922  it_vert->get_coordinates ( vert );
923  std::vector<Coordinate> new_vert = project_point ( bdd, vert, mat );
924  int vert_id = it_vert->index ( );
925  bdry_mesh->replace_vertex ( new_vert, vert_id );
926  }
927  }
928  }
int MaterialNumber
Type for the material number.
Definition: types.h:86
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58
std::vector< Coordinate > project_point(const BoundaryDomainDescriptor &bdd, const std::vector< Coordinate > &p, const MaterialNumber mat)
Returns the point that is closest to p but still on the domain given by the BoundaryDomainDescriptor...

◆ add_global() [1/2]

template<class DataType >
void hiflow::add_global ( const VectorSpace< DataType > &  space,
const std::vector< int > &  row_dofs,
const std::vector< int > &  col_dofs,
const typename GlobalAssembler< DataType >::LocalMatrix &  lm,
typename GlobalAssembler< DataType >::GlobalMatrix &  gm 
)

Definition at line 36 of file dg_assembly.cc.

References hiflow::la::Matrix< DataType >::Add(), hiflow::VectorSpace< DataType >::dof(), hiflow::la::SeqDenseMatrix< DataType >::Resize(), sortingPermutation(), and vec2ptr().

Referenced by hiflow::DGGlobalAssembler< DataType >::assemble_interface_matrix(), and hiflow::DGGlobalAssembler< DataType >::assemble_interface_vector().

41  {
42 
43  const int num_dofs_row = row_dofs.size ( );
44  const int num_dofs_col = col_dofs.size ( );
45 
46  std::vector<int> row_dofs_sort_permutation;
47  std::vector<int> col_dofs_sort_permutation;
48  std::vector<int> row_dofs_sorted ( num_dofs_row );
49  std::vector<int> col_dofs_sorted ( num_dofs_col );
50 
51  // get permutation for sorting dofs
52  sortingPermutation ( row_dofs, row_dofs_sort_permutation );
53  sortingPermutation ( col_dofs, col_dofs_sort_permutation );
54 
55  // fill sorted dof array
56  for ( size_t i = 0; i != num_dofs_row; ++i )
57  {
58  row_dofs_sorted[i] = row_dofs[row_dofs_sort_permutation[i]];
59  }
60  for ( size_t i = 0; i != num_dofs_col; ++i )
61  {
62  col_dofs_sorted[i] = col_dofs[col_dofs_sort_permutation[i]];
63  }
64 
65  // create row array
66  std::vector<int> row_indices;
67  std::vector<int> row_permutation;
68  row_indices.reserve ( num_dofs_row );
69  row_permutation.reserve ( num_dofs_row );
70  for ( size_t i = 0; i != num_dofs_row; ++i )
71  {
72  if ( space.dof ( ).is_dof_on_sd ( row_dofs_sorted[i] ) )
73  {
74  row_indices.push_back ( row_dofs_sorted[i] );
75  row_permutation.push_back ( row_dofs_sort_permutation[i] );
76  }
77  }
78 
79  // fill reduced and sorted local matrix
80  typename GlobalAssembler<DataType>::LocalMatrix local_mat_sorted_reduced;
81  if ( row_indices.size ( ) > 0 && col_dofs_sorted.size ( ) > 0 )
82  {
83  local_mat_sorted_reduced.Resize ( row_indices.size ( ), col_dofs_sorted.size ( ) );
84  for ( size_t i = 0; i != row_indices.size ( ); ++i )
85  {
86  for ( size_t j = 0; j != col_dofs_sorted.size ( ); ++j )
87  {
88  local_mat_sorted_reduced ( i, j ) = lm ( row_permutation[i], col_dofs_sort_permutation[j] );
89  }
90  }
91 
92  // Add local to global matrix
93  gm.Add ( vec2ptr ( row_indices ), row_indices.size ( ), vec2ptr ( col_dofs_sorted ), col_dofs_sorted.size ( ), &local_mat_sorted_reduced ( 0, 0 ) );
94  }
95  }
void sortingPermutation(const std::vector< T > &values, std::vector< int > &v)
Function to get the corresponding permutation for sorting of values vector. Permutation vector is all...
T * vec2ptr(std::vector< T > &vec)
Conversion from vector to pointer to first element.
Definition: pointers.h:57

◆ add_global() [2/2]

template<class DataType >
void hiflow::add_global ( const VectorSpace< DataType > &  space,
const std::vector< int > &  dofs,
const typename GlobalAssembler< DataType >::LocalVector &  lv,
typename GlobalAssembler< DataType >::GlobalVector &  vec 
)

Definition at line 98 of file dg_assembly.cc.

References hiflow::la::Vector< DataType >::Add(), hiflow::VectorSpace< DataType >::dof(), sortingPermutation(), and vec2ptr().

102  {
103 
104  const int num_dofs = dofs.size ( );
105 
106  std::vector<int> dofs_sort_permutation;
107  std::vector<int> dofs_sorted ( num_dofs );
108 
109  // get permutation for sorting dofs
110  sortingPermutation ( dofs, dofs_sort_permutation );
111 
112  // fill sorted dof array
113  for ( size_t i = 0; i != num_dofs; ++i )
114  {
115  dofs_sorted[i] = dofs[dofs_sort_permutation[i]];
116  }
117 
118  // create row array
119  std::vector<int> row_indices;
120  row_indices.reserve ( num_dofs );
121 
122  typename GlobalAssembler<DataType>::LocalVector local_vec_sorted;
123  local_vec_sorted.reserve ( num_dofs );
124 
125  for ( size_t i = 0; i != num_dofs; ++i )
126  {
127  if ( space.dof ( ).is_dof_on_sd ( dofs_sorted[i] ) )
128  {
129  row_indices.push_back ( dofs_sorted[i] );
130  local_vec_sorted.push_back ( lv[dofs_sort_permutation[i]] );
131  }
132  }
133 
134  // Add local to global vector
135  if ( row_indices.size ( ) > 0 )
136  {
137  vec.Add ( vec2ptr ( row_indices ), row_indices.size ( ), vec2ptr ( local_vec_sorted ) );
138  }
139  }
void sortingPermutation(const std::vector< T > &values, std::vector< int > &v)
Function to get the corresponding permutation for sorting of values vector. Permutation vector is all...
T * vec2ptr(std::vector< T > &vec)
Conversion from vector to pointer to first element.
Definition: pointers.h:57

◆ compute_dirichlet_dofs_and_values()

template<class DirichletEvaluator , class DataType >
void hiflow::compute_dirichlet_dofs_and_values ( DirichletEvaluator &  dirichlet_eval,
const VectorSpace< DataType > &  space,
int  var,
std::vector< doffem::DofID > &  dirichlet_dofs,
std::vector< DataType > &  dirichlet_values 
)

Locate and evaluate Dirichlet boundary conditions.

The function loops over all boundary facets and calls a user-provided function object (a functor) to obtain the values for the Dirichlet dofs on that boundary facet. This functor has to provide at least one function called evaluate, with the facet entity and a vector with the coordinates on that facet, that returns a std::vector<double> with the Dirichlet values for the dofs on this boundary facet. If the dofs of the boundary should not be constrained, an empty vector should be returned.

Parameters
[in]dirichlet_evaluser-provided function object which computes the dirichlet values.
[in]spacespace object containing the mesh and the FE approximation.
[in]varvariable for which the dirichlet dofs should be set. The function can be called several times for vector-valued problems.
[out]dirichlet_dofsvector to which the indices of the dirichlet dofs are appended.
[out]dirichlet_valuesvector which the values of the dirichlet dofs are appended.

Definition at line 79 of file dirichlet_boundary_conditions.h.

References hiflow::mesh::Entity::begin_incident(), hiflow::VectorSpace< DataType >::dof(), hiflow::mesh::Mesh::extract_boundary_mesh(), find_dofs_and_coords_on_face(), hiflow::mesh::Mesh::find_entity(), hiflow::mesh::Mesh::get_entity(), hiflow::VectorSpace< DataType >::get_mpi_comm(), hiflow::mesh::Mesh::has_attribute(), hiflow::VectorSpace< DataType >::mesh(), and hiflow::mesh::Mesh::tdim().

Referenced by hiflow::la::gmg::BasicLevel< LAD >::init_boundary_conditions().

83  {
84  using namespace mesh;
85 
86  typedef std::vector<DataType> Coord;
87 
88  const Mesh& mesh = space.mesh ( );
89  const TDim tdim = mesh.tdim ( );
90 
91  // extract boundary of mesh
92  MeshPtr boundary_mesh = mesh.extract_boundary_mesh ( );
93 
94  int rank = -1, size = -1;
95  MPI_Comm_rank ( space.get_mpi_comm ( ), &rank );
96  MPI_Comm_size ( space.get_mpi_comm ( ), &size );
97 
98  const bool is_sequential = ( size == 1 );
99  if ( !is_sequential )
100  {
101  assert ( mesh.has_attribute ( "_sub_domain_", tdim ) );
102  }
103 
104  // Loop over all faces which belong to the boundary
105  for ( EntityIterator it_boundary = boundary_mesh->begin ( tdim - 1 );
106  it_boundary != boundary_mesh->end ( tdim - 1 );
107  ++it_boundary )
108  {
109  // get id of boundary face
110  const Id boundary_id = it_boundary->id ( );
111 
112  // check if the boundary face exists and get the location
113  // where the entity number should be stored
114  int face_number;
115  const bool check = mesh.find_entity ( tdim - 1, boundary_id, &face_number );
116  assert ( check );
117 
118  // Get the face to be able to access to the data associated with the face
119  Entity face = mesh.get_entity ( tdim - 1, face_number );
120 
121  // reset the cell because it was changed in the assert above
122  IncidentEntityIterator cell = face.begin_incident ( tdim );
123 
124  std::vector<doffem::DofID> dofs_on_face;
125  std::vector<Coord> coords_on_face;
126 
127  // Get the dofs indices and coords on the face
128  find_dofs_and_coords_on_face ( it_boundary, space, var, dofs_on_face,
129  coords_on_face );
130 
131  assert ( dofs_on_face.size ( ) == coords_on_face.size ( ) );
132 
133  // Evaluate user's function
134  const std::vector<DataType> values_on_face =
135  dirichlet_eval.evaluate ( *it_boundary, coords_on_face );
136 
137  if ( !values_on_face.empty ( ) )
138  {
139  // If non-empty vector was returned, insert into output vectors
140  // vectors to filter out only dofs that belong to our subdomain
141  std::vector<doffem::DofID> dofs_on_face_checked;
142  std::vector<DataType> values_on_face_checked;
143 
144  dofs_on_face_checked.reserve ( dofs_on_face.size ( ) );
145  values_on_face_checked.reserve ( dofs_on_face.size ( ) );
146 
147  int k = 0;
148  for ( std::vector<doffem::DofID>::iterator dof_it = dofs_on_face.begin ( );
149  dof_it != dofs_on_face.end ( ); ++dof_it )
150  {
151  if ( space.dof ( ).owner_of_dof ( *dof_it ) == rank )
152  {
153  dofs_on_face_checked.push_back ( *dof_it );
154  values_on_face_checked.push_back ( values_on_face.at ( k ) );
155  }
156  ++k;
157  }
158 
159  dirichlet_dofs.insert ( dirichlet_dofs.end ( ), dofs_on_face_checked.begin ( ),
160  dofs_on_face_checked.end ( ) );
161  dirichlet_values.insert ( dirichlet_values.end ( ),
162  values_on_face_checked.begin ( ),
163  values_on_face_checked.end ( ) );
164  }
165  }
166  }
Abstract base class for mesh implementations.
int Id
Type for representing entity Id:s. Id:s are arbitrary, non-negative integer values.
Definition: types.h:68
int TDim
Definition: types.h:79
void find_dofs_and_coords_on_face(const mesh::EntityIterator &boundary_face, const VectorSpace< DataType > &space, int var, std::vector< doffem::DofID > &dof_ids, std::vector< std::vector< DataType > > &dof_points)
Finds the dofs and the coords on a given (boundary) facet.
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58

◆ compute_ghost_cells()

mesh::MeshPtr hiflow::compute_ghost_cells ( const Mesh local_mesh,
const MPI_Comm &  comm,
SharedVertexTable shared_verts,
IMPL  impl,
int  layer_width 
)

Create new mesh containing the ghost cells from neighboring sub-domains.
CAUTION: In order to refine the mesh locally, layer_width has to be at least 2.

The ghost cells are computed in two steps. First, a search to identify the vertices shared with other processes is performed, and the results are stored in the shared_verts object. Second, the cells containing shared vertices are exchanged between all neighboring processes (i.e. processes that share at least one vertex).

The returned mesh object contains an integer attribute named "__sub_domain__" which contains the owner process number for all cells. Another integer attribute "__remote_index__" contains the index of the cell for all ghost cells, and -1 for all local cells.

Currently, this function is limited to work only with meshes whose concrete type is MeshDbView. The function will throw a "bad_cast" exception if this is not the case.

Parameters
local_meshThe mesh on the current process.
commMPI communicator over which communication is performed.
[in,out]shared_vertsTable with information about shared vertices.
Returns
Shared pointer to mesh object containing ghost cells.

Definition at line 705 of file mesh_tools.cc.

References compute_ghost_cells_dbview(), compute_ghost_cells_pXest(), hiflow::mesh::IMPL_DBVIEW, hiflow::mesh::IMPL_P4EST, and LOG_ERROR.

Referenced by hiflow::la::gmg::BasicLevel< LAD >::BasicLevel(), hiflow::SpacePatchInterpolation< LAD, MESH_IMPL >::compute_ghost(), and hiflow::DynamicMeshHandler< LAD, MESH_IMPL, DIM >::refine().

706  {
707  assert ( impl == IMPL_DBVIEW || impl == IMPL_P4EST );
708 
709  if ( impl == IMPL_P4EST )
710  {
711 #ifdef WITH_P4EST
712  return compute_ghost_cells_pXest ( local_mesh, comm, layer_width );
713 #else
714  LOG_ERROR ( "Not compiled with p4ests support!" );
715  exit ( -1 );
716 #endif
717  }
718  if ( impl == IMPL_DBVIEW )
719  {
720  return compute_ghost_cells_dbview ( local_mesh, comm, shared_verts );
721  }
722  //assert (impl == IMPL_DBVIEW);
723  //return compute_ghost_cells_dbview(local_mesh, comm, shared_verts );
724  }
#define LOG_ERROR(stream)
Log an error message to the log "error".
Definition: log.h:233
MeshPtr compute_ghost_cells_dbview(const Mesh &local_mesh, const MPI_Comm &comm, SharedVertexTable &shared_verts)
Create new mesh containing the ghost cells from neighboring sub-domains. Implementation for MeshDbVie...
Definition: mesh_tools.cc:1025
MeshPtr compute_ghost_cells_pXest(const Mesh &local_mesh, const MPI_Comm &comm, int layer_width)
Create new mesh containing the ghost cells from neighboring sub-domains. Implementation for MeshP4est...
Definition: mesh_tools.cc:1436

◆ compute_ghost_cells_dbview()

mesh::MeshPtr hiflow::compute_ghost_cells_dbview ( const Mesh local_mesh,
const MPI_Comm &  comm,
SharedVertexTable shared_verts 
)

Create new mesh containing the ghost cells from neighboring sub-domains. Implementation for MeshDbView.

Definition at line 1025 of file mesh_tools.cc.

References hiflow::mesh::communicate_ghost_cell_facets(), hiflow::mesh::communicate_ghost_cells(), hiflow::mesh::Mesh::num_entities(), hiflow::mesh::Mesh::tdim(), and hiflow::mesh::update_shared_vertex_table().

Referenced by compute_ghost_cells().

1026  {
1027  int rank = -1;
1028  MPI_Comm_rank ( comm, &rank );
1029 
1030  // TODO this function only works if the concrete type of the mesh is MeshDbView.
1031  // otherwise exception is thrown here
1032  const MeshDbView& mesh_db_view = dynamic_cast < const MeshDbView& > ( local_mesh );
1033 
1034  // exchange shared vertices with other processes
1035  update_shared_vertex_table ( mesh_db_view, comm, shared_verts );
1036 
1037  // objects needed for ghost cell communication
1038  const TDim tdim = local_mesh.tdim ( );
1039  std::vector<SubDomainId> sub_domains ( local_mesh.num_entities ( tdim ), rank );
1040  std::vector<EntityNumber> remote_indices ( local_mesh.num_entities ( tdim ), -1 );
1041  MeshDbViewBuilder builder ( mesh_db_view );
1042 
1043  // communicate ghost cells and their facets
1044  communicate_ghost_cells ( mesh_db_view, comm, shared_verts, builder, sub_domains, remote_indices );
1045  communicate_ghost_cell_facets ( mesh_db_view, comm, shared_verts, builder );
1046  MeshPtr mesh_with_ghost_cells ( builder.build ( ) );
1047 
1048  // add attributes to new mesh
1049  AttributePtr sub_domain_attr = AttributePtr ( new IntAttribute ( sub_domains ) );
1050  mesh_with_ghost_cells->add_attribute ( "_sub_domain_", tdim, sub_domain_attr );
1051  AttributePtr remote_index_attr = AttributePtr ( new IntAttribute ( remote_indices ) );
1052  mesh_with_ghost_cells->add_attribute ( "_remote_index_", tdim, remote_index_attr );
1053 
1054  return mesh_with_ghost_cells;
1055  }
void update_shared_vertex_table(const Mesh &mesh, const MPI_Comm &comm, SharedVertexTable &table)
Update a shared vertex table for all vertices in given mesh through MPI communication.
void communicate_ghost_cells(const Mesh &mesh, const MPI_Comm &comm, const SharedVertexTable &shared_bdy_vertices, MeshBuilder &builder, std::vector< SubDomainId > &sub_domains, std::vector< EntityNumber > &remote_indices)
Communicates ghost cells.
int TDim
Definition: types.h:79
void communicate_ghost_cell_facets(const Mesh &mesh, const MPI_Comm &comm, const SharedVertexTable &shared_bdy_vertices, MeshBuilder &builder)
Communicates facets of ghost cells.
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58
SharedPtr< Attribute >::Type AttributePtr
Definition: attributes.h:52

◆ compute_ghost_cells_pXest()

mesh::MeshPtr hiflow::compute_ghost_cells_pXest ( const Mesh local_mesh,
const MPI_Comm &  comm,
int  layer_width 
)

Create new mesh containing the ghost cells from neighboring sub-domains. Implementation for MeshP4est.

Definition at line 1436 of file mesh_tools.cc.

References hiflow::mesh::MeshPXest::add_ghost_cells(), and LOG_ERROR.

Referenced by compute_ghost_cells(), and load_mesh().

1437  {
1438 #ifdef WITH_P4EST
1439  if ( layer_width < 2 )
1440  {
1441  int rank;
1442  MPI_Comm_rank ( comm, &rank );
1443  if ( rank == 0 )
1444  {
1445  std::cout << "CAUTION: You have chosen a ghost layer width of 1. In order to make use of local mesh refinement, layer width has to be 2 !!!" << std::endl;
1446  }
1447  }
1448 
1449  ConstMeshPtr tmp_mesh = &local_mesh;
1450  boost::intrusive_ptr<const MeshPXest> local_mesh_pXest = boost::static_pointer_cast<const MeshPXest> ( tmp_mesh );
1451  return local_mesh_pXest->add_ghost_cells ( comm, layer_width );
1452 #else
1453  LOG_ERROR ( "Not compiled with p4ests support!" );
1454  exit ( -1 );
1455 #endif
1456  }
#define LOG_ERROR(stream)
Log an error message to the log "error".
Definition: log.h:233
boost::intrusive_ptr< const Mesh > ConstMeshPtr
Definition: types.h:62

◆ compute_hp_sparsity_structure()

template<class DataType >
void hiflow::compute_hp_sparsity_structure ( const VectorSpace< DataType > &  space,
SparsityStructure sparsity,
std::vector< std::vector< bool > > *  coupling_vars 
)

Definition at line 42 of file hp_assembly.cc.

References hiflow::mesh::Mesh::begin(), pretty_print::begin(), hiflow::SparsityStructure::diagonal_cols, hiflow::SparsityStructure::diagonal_rows, hiflow::VectorSpace< DataType >::dof(), hiflow::doffem::DegreeOfFreedom< DataType >::dof_interpolation(), hiflow::mesh::Mesh::end(), pretty_print::end(), hiflow::doffem::DofPartition< DataType >::get_my_subdomain(), hiflow::VectorSpace< DataType >::get_nb_var(), hiflow::VectorSpace< DataType >::GetDofIndices(), hiflow::doffem::DofPartition< DataType >::global2local(), hiflow::doffem::DofPartition< DataType >::is_dof_on_sd(), hiflow::doffem::DofPartition< DataType >::local2global(), LOG_DEBUG, hiflow::VectorSpace< DataType >::mesh(), hiflow::doffem::DofPartition< DataType >::ndofs_on_sd(), hiflow::SparsityStructure::off_diagonal_cols, hiflow::SparsityStructure::off_diagonal_rows, and hiflow::mesh::Mesh::tdim().

Referenced by hiflow::HpFemAssembler< DataType >::compute_sparsity_structure_impl().

43  {
44 
45  // Assert correct size of coupling_vars
46 
47  assert ( coupling_vars->size ( ) == space.get_nb_var ( ) );
48  for ( size_t i = 0, e_i = space.get_nb_var ( ); i != e_i; ++i )
49  {
50  assert ( ( *coupling_vars )[i].size ( ) == space.get_nb_var ( ) );
51  }
52 
53  // TODO: refactor function to avoid all the repetitions
54 
55  typedef typename VectorSpace<DataType>::MeshEntityIterator CellIterator;
56  typedef std::vector<int>::const_iterator DofIterator;
57  const mesh::Mesh& mesh = space.mesh ( );
58  const mesh::TDim tdim = mesh.tdim ( );
59 
60  std::vector<int> dofs_test, dofs_trial;
61 
62  const DofInterpolation& interpolation = space.dof ( ).dof_interpolation ( );
63  const int num_total_dofs = space.dof ( ).ndofs_on_sd ( space.dof ( ).get_my_subdomain ( ) );
64  int local_row_dof;
65 
66  // NB: We assume that unconstrained dofs are numbered before
67  // constrained dofs, in order to be able to use a vector here.
68  std::vector< SortedArray<int> > diagonal_couplings ( num_total_dofs );
69  std::vector< SortedArray<int> > off_diagonal_couplings ( num_total_dofs );
70 
71  // Loop over all cells
72  for ( CellIterator cell_it = mesh.begin ( tdim ), cell_end = mesh.end ( tdim );
73  cell_it != cell_end; ++cell_it )
74  {
75 
76  // loop over test variables
77  for ( size_t test_var = 0, e_test_var = space.get_nb_var ( ); test_var != e_test_var; ++test_var )
78  {
79  // Get dof id:s on cell
80  space.GetDofIndices ( test_var, *cell_it, &dofs_test );
81 
82  // Loop over rows corresponding to local dofs.
83  for ( DofIterator it_i = dofs_test.begin ( ), end_i = dofs_test.end ( ); it_i != end_i; ++it_i )
84  {
85 
86  // search current dof it_i in DofInterpolation map
87  DofInterpolation::const_iterator dof_i = interpolation.find ( *it_i );
88 
89  if ( dof_i != interpolation.end ( ) )
90  {
91  // Case A: dofs_test[*it_i] (row) constrained
92 
93  // Loop over all interpolating dofs of current dof it_i
94  for ( ConstraintIterator ci_it = dof_i->second.begin ( ), ci_end = dof_i->second.end ( ); ci_it != ci_end; ++ci_it )
95  {
96 
97  // skip rows that are not on our sub-domain
98  if ( space.dof ( ).is_dof_on_sd ( ci_it->first ) )
99  {
100 
101  // get row index to use for insertion
102  space.dof ( ).global2local ( ci_it->first, &local_row_dof );
103 
104  // loop over trial variables
105  for ( size_t trial_var = 0, e_trial_var = space.get_nb_var ( ); trial_var != e_trial_var; ++trial_var )
106  {
107 
108  // check if coupling exists
109  if ( ( *coupling_vars )[test_var][trial_var] )
110  {
111 
112  // Get dof id:s on cell
113  space.GetDofIndices ( trial_var, *cell_it, &dofs_trial );
114 
115  // Loop over columns corresponding to local dofs.
116  for ( DofIterator it_j = dofs_trial.begin ( ), end_j = dofs_trial.end ( );
117  it_j != end_j; ++it_j )
118  {
119 
120  // search current dof it_j in DofInterpolation map
121  DofInterpolation::const_iterator dof_j = interpolation.find ( *it_j );
122 
123  if ( dof_j != interpolation.end ( ) )
124  {
125  // Case A1: dofs_trial[*it_j] (column) constrained
126 
127  // Loop over all interpolating dofs of current dof it_j
128  for ( ConstraintIterator cj_it = dof_j->second.begin ( ), cj_end = dof_j->second.end ( ); cj_it != cj_end; ++cj_it )
129  {
130  // determine target for insertion
131  if ( space.dof ( ).is_dof_on_sd ( cj_it->first ) )
132  {
133  diagonal_couplings[local_row_dof].find_insert ( cj_it->first );
134  }
135  else
136  {
137  off_diagonal_couplings[local_row_dof].find_insert ( cj_it->first );
138  }
139 
140  LOG_DEBUG ( 2, "[" << space.dof ( ).get_my_subdomain ( ) << "] Constrained row = " << local_row_dof
141  << ", constrained col = " << cj_it->first
142  << ", diagonal ? " << space.dof ( ).is_dof_on_sd ( cj_it->first ) );
143 
144  }
145  }
146  else
147  {
148  // Case A2: dofs_trial[*it_j] (column) unconstrained
149  // determine target for insertion
150  if ( space.dof ( ).is_dof_on_sd ( *it_j ) )
151  {
152  diagonal_couplings[local_row_dof].find_insert ( *it_j );
153  }
154  else
155  {
156  off_diagonal_couplings[local_row_dof].find_insert ( *it_j );
157  }
158 
159  LOG_DEBUG ( 2, "[" << space.dof ( ).get_my_subdomain ( ) << "] Constrained row = " << local_row_dof
160  << ", unconstrained col = " << *it_j
161  << ", diagonal ? " << space.dof ( ).is_dof_on_sd ( *it_j ) );
162  }
163  }
164  }
165  }
166  }
167  }
168  }
169  else
170  {
171  // Case B: dofs_test[*it_i] (row) unconstrained
172 
173  // skip rows that are not on our sub-domain
174  if ( space.dof ( ).is_dof_on_sd ( *it_i ) )
175  {
176 
177  space.dof ( ).global2local ( *it_i, &local_row_dof );
178 
179  // loop over trial variables
180  for ( size_t trial_var = 0, e_trial_var = space.get_nb_var ( ); trial_var != e_trial_var; ++trial_var )
181  {
182 
183  // check if coupling exists
184  if ( ( *coupling_vars )[test_var][trial_var] )
185  {
186 
187  // Get dof id:s on cell
188  space.GetDofIndices ( trial_var, *cell_it, &dofs_trial );
189 
190  // Loop over columns corresponding to local dofs.
191  for ( DofIterator it_j = dofs_trial.begin ( ), end_j = dofs_trial.end ( ); it_j != end_j; ++it_j )
192  {
193 
194  // search current dof it_j in DofInterpolation map
195  DofInterpolation::const_iterator dof_j = interpolation.find ( *it_j );
196 
197  if ( dof_j != interpolation.end ( ) )
198  {
199  // Case B1: dofs_trial[*it_j] (column) constrained
200 
201  // Loop over all interpolating dofs of current dof it_j
202  for ( ConstraintIterator cj_it = dof_j->second.begin ( ), cj_end = dof_j->second.end ( ); cj_it != cj_end; ++cj_it )
203  {
204  // determine target for insertion
205  // -> diagonal or off-diagonal
206  if ( space.dof ( ).is_dof_on_sd ( cj_it->first ) )
207  {
208  diagonal_couplings[local_row_dof].find_insert ( cj_it->first );
209  }
210  else
211  {
212  off_diagonal_couplings[local_row_dof].find_insert ( cj_it->first );
213  }
214 
215  LOG_DEBUG ( 2, "[" << space.dof ( ).get_my_subdomain ( ) << "] Unconstrained row = " << local_row_dof
216  << ", constrained col = " << cj_it->first
217  << ", diagonal ? " << space.dof ( ).is_dof_on_sd ( cj_it->first ) );
218  }
219  }
220  else
221  {
222  // Case B2: dofs_trial[*it_j] (column) unconstrained
223  // determine target for insertion
224  // -> diagonal or off-diagonal
225  if ( space.dof ( ).is_dof_on_sd ( *it_j ) )
226  {
227  diagonal_couplings[local_row_dof].find_insert ( *it_j );
228  }
229  else
230  {
231  off_diagonal_couplings[local_row_dof].find_insert ( *it_j );
232  }
233 
234  LOG_DEBUG ( 3, "[" << space.dof ( ).get_my_subdomain ( ) << "] Unconstrained row = " << local_row_dof
235  << ", unconstrained col = " << *it_j
236  << ", diagonal ? " << space.dof ( ).is_dof_on_sd ( *it_j ) );
237  }
238  }
239  }
240  }
241  }
242  }
243  // Add diagonal entry
244  if ( space.dof ( ).is_dof_on_sd ( *it_i ) )
245  {
246  space.dof ( ).global2local ( *it_i, &local_row_dof );
247  diagonal_couplings[local_row_dof].find_insert ( *it_i );
248 
249  LOG_DEBUG ( 2, "[" << space.dof ( ).get_my_subdomain ( ) << "] Diagonal row = " << local_row_dof << ", diagonal col = " << local_row_dof );
250  }
251  }
252  }
253  }
254 
255  // Compute number of non-zeros for both blocks
256  int nnz_diagonal = 0;
257  int nnz_off_diagonal = 0;
258 
259  for ( size_t i = 0; i != num_total_dofs; ++i )
260  {
261  nnz_diagonal += diagonal_couplings[i].size ( );
262  nnz_off_diagonal += off_diagonal_couplings[i].size ( );
263  }
264 
265  // Copy into SparsityStructure
266  sparsity.diagonal_rows.resize ( nnz_diagonal );
267  sparsity.diagonal_cols.resize ( nnz_diagonal );
268  sparsity.off_diagonal_rows.resize ( nnz_off_diagonal );
269  sparsity.off_diagonal_cols.resize ( nnz_off_diagonal );
270 
271  int global_dof_id;
272  int index = 0;
273  for ( size_t i = 0; i != num_total_dofs; ++i )
274  {
275  space.dof ( ).local2global ( i, &global_dof_id );
276 
277  for ( SortedArray<int>::const_iterator it = diagonal_couplings[i].begin ( ),
278  end = diagonal_couplings[i].end ( ); it != end; ++it )
279  {
280  sparsity.diagonal_rows[index] = global_dof_id;
281  sparsity.diagonal_cols[index] = *it;
282  ++index;
283  }
284  }
285  assert ( index == nnz_diagonal );
286 
287  index = 0;
288  for ( size_t i = 0; i != num_total_dofs; ++i )
289  {
290  space.dof ( ).local2global ( i, &global_dof_id );
291 
292  for ( SortedArray<int>::const_iterator it = off_diagonal_couplings[i].begin ( ),
293  end = off_diagonal_couplings[i].end ( ); it != end; ++it )
294  {
295  sparsity.off_diagonal_rows[index] = global_dof_id;
296  sparsity.off_diagonal_cols[index] = *it;
297  ++index;
298  }
299  }
300  assert ( index == nnz_off_diagonal );
301  }
std::vector< std::pair< int, double > >::const_iterator ConstraintIterator
Definition: hp_assembly.cc:36
#define LOG_DEBUG(lvl, stream)
Definition: log.h:221
int TDim
Definition: types.h:79
array_type::const_iterator const_iterator
Definition: sorted_array.h:46
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type begin(const T &c)

◆ compute_sorting_permutation()

void hiflow::compute_sorting_permutation ( const std::vector< int > &  values,
std::vector< int > &  permutation 
)
inline

Definition at line 49 of file permutation.h.

Referenced by hiflow::EvalDerivativeFeFunction< LAD, DIM >::EvalDerivativeFeFunction(), hiflow::EvalFeFunction< LAD >::EvalFeFunction(), hiflow::EvalFeFunction2< LAD >::EvalFeFunction2(), hiflow::mesh::MeshDbView::extract_boundary_mesh(), and hiflow::mesh::RefinedMeshDbView::RefinedMeshDbView().

51  {
52  const size_t N = values.size ( );
53  permutation.resize ( N );
54  for ( size_t i = 0; i < N; ++i )
55  {
56  permutation[i] = i;
57  }
58 
59  VectorMapCmp cmp ( values );
60  std::stable_sort ( permutation.begin ( ), permutation.end ( ), cmp );
61  }

◆ create_distributed_mesh()

mesh::MeshPtr hiflow::create_distributed_mesh ( const mesh::MeshPtr  master_mesh,
const int  master_rank,
const MPI_Comm &  comm,
std::vector< int > &  partitioning,
mesh::IMPL  impl 
)

creates a distributed mesh from sequential master_mesh for a given partitioning

extract local mesh from sequential master_mesh for a given partitioning

Subfunction that returns a distributed mesh, given a master_mesh with corresponding partitioning

Definition at line 368 of file mesh_tools.cc.

References hiflow::mesh::MpiScatter::communicate(), hiflow::mesh::compute_cell_distribution(), hiflow::mesh::compute_facet_from_cell_distribution(), hiflow::mesh::EntityPackage::gdim, hiflow::mesh::IMPL_DBVIEW, hiflow::mesh::IMPL_P4EST, LOG_DEBUG, LOG_ERROR, hiflow::mesh::EntityPackage::material_numbers, hiflow::mesh::CellDistribution::num_cells, hiflow::mesh::EntityPackage::offsets, hiflow::mesh::pack_distributed_entities(), string_from_range(), hiflow::mesh::EntityPackage::tdim, and hiflow::mesh::unpack_entities().

Referenced by partition_and_distribute_dbview(), and partition_and_distribute_pXest().

373  {
374  int my_rank = -1, num_ranks = -2;
375  MPI_Comm_rank ( comm, &my_rank );
376  MPI_Comm_size ( comm, &num_ranks );
377  assert ( 0 <= my_rank );
378  assert ( 0 <= master_rank );
379  assert ( master_rank < num_ranks );
380  assert ( my_rank < num_ranks );
381 
382  // check that master_mesh is non-null iff we are on master process
383  assert ( my_rank != master_rank || master_mesh != 0 );
384  assert ( my_rank == master_rank || master_mesh == 0 );
385  assert ( impl == mesh::IMPL_DBVIEW || impl == mesh::IMPL_P4EST );
386 
387  // Communicate period
388  std::vector<MasterSlave> period ( 0 );
389  if ( my_rank == master_rank )
390  {
391  period = master_mesh->get_period ( );
392  }
393  int num_period = period.size ( );
394  MPI_Bcast ( &num_period, 1, MPI_INT, master_rank, comm );
395  for ( int k = 0; k < num_period; ++k )
396  {
397  std::vector<double> period_dbl_values ( 3, 0. );
398  int period_index;
399  if ( my_rank == master_rank )
400  {
401  period_dbl_values[0] = period[k].master ( );
402  period_dbl_values[1] = period[k].slave ( );
403  period_dbl_values[2] = period[k].h ( );
404  period_index = period[k].index ( );
405  }
406  MPI_Bcast ( &period_dbl_values[0], 3, MPI_DOUBLE, master_rank, comm );
407 
408  MPI_Bcast ( &period_index, 1, MPI_INT, master_rank, comm );
409  if ( my_rank != master_rank )
410  period.push_back ( MasterSlave ( period_dbl_values[0], period_dbl_values[1], period_dbl_values[2], period_index ) );
411  }
412 
413  std::vector<EntityPackage> sent_entities;
414  EntityPackage recv_entities;
415  std::vector<EntityPackage> sent_facet_entities;
416  EntityPackage recv_facet_entities;
417  std::vector<int> num_entities_on_proc;
418  std::vector<int> num_facet_entities_on_proc;
419 
420  if ( my_rank == master_rank )
421  {
422  const TDim tdim = master_mesh->tdim ( );
423 
424  // compute distribution of cells from the partitioning
425  CellDistribution distribution;
426  compute_cell_distribution ( num_ranks, partitioning, &distribution );
427 
428  assert ( static_cast < int > ( distribution.num_cells.size ( ) ) == num_ranks );
429 
430  // compute distribution of facets from cell distribution
431  CellDistribution facet_distribution;
432  compute_facet_from_cell_distribution ( *master_mesh, distribution, &facet_distribution );
433 
434  // prepare sent entities
435  pack_distributed_entities ( *master_mesh, tdim, distribution, sent_entities );
436  pack_distributed_entities ( *master_mesh, tdim - 1, facet_distribution, sent_facet_entities );
437 
438  // use num_cells vector from distribution for num_entities_on_proc
439  num_entities_on_proc.swap ( distribution.num_cells );
440  num_facet_entities_on_proc.swap ( facet_distribution.num_cells );
441  LOG_DEBUG ( 2, "num_entities_on_proc = "
442  << string_from_range ( num_entities_on_proc.begin ( ), num_entities_on_proc.end ( ) ) );
443  LOG_DEBUG ( 2, "num_facet_entities_on_proc = "
444  << string_from_range ( num_facet_entities_on_proc.begin ( ), num_facet_entities_on_proc.end ( ) ) );
445  }
446 
447  // Communicate cells
448  MpiScatter scatter ( comm, master_rank, num_entities_on_proc );
449  scatter.communicate ( sent_entities, recv_entities );
450 
451  LOG_DEBUG ( 2, "Received " << recv_entities.offsets.size ( ) << " cells on proc " << my_rank );
452 
453  // unpack the received part of the mesh into a builder
454  MeshBuilder* builder;
455  if ( impl == mesh::IMPL_DBVIEW )
456  {
457  builder = new MeshDbViewBuilder ( recv_entities.tdim, recv_entities.gdim, period );
458  }
459  if ( impl == mesh::IMPL_P4EST )
460  {
461 #ifdef WITH_P4EST
462  builder = new MeshPXestBuilder ( recv_entities.tdim, recv_entities.gdim, period );
463 #else
464  LOG_ERROR ( "Not compiled with p4ests support!" );
465  exit ( -1 );
466 #endif
467  }
468 
469  unpack_entities ( recv_entities, *builder );
470 
471  // Communicate facets
472  MpiScatter facet_scatter ( comm, master_rank, num_facet_entities_on_proc );
473  facet_scatter.communicate ( sent_facet_entities, recv_facet_entities );
474 
475  LOG_DEBUG ( 2, "Received " << recv_facet_entities.offsets.size ( ) << " facets on proc " << my_rank );
476 
477  LOG_DEBUG ( 3, "Received material numbers "
478  << string_from_range ( recv_facet_entities.material_numbers.begin ( ),
479  recv_facet_entities.material_numbers.end ( ) )
480  << " on proc " << my_rank << "\n" );
481 
482  // unpack the received facets into a builder
483  unpack_entities ( recv_facet_entities, *builder );
484 
485  // build the local mesh
486  MeshPtr recv_mesh ( builder->build ( ) );
487  delete builder;
488  return recv_mesh;
489  }
#define LOG_ERROR(stream)
Log an error message to the log "error".
Definition: log.h:233
#define LOG_DEBUG(lvl, stream)
Definition: log.h:221
int TDim
Definition: types.h:79
void compute_facet_from_cell_distribution(const Mesh &mesh, const CellDistribution &cell_distribution, CellDistribution *facet_distribution)
Compute the facet distribution corresponding to a cell distribution.
void compute_cell_distribution(const int num_partitions, const std::vector< int > &partitioning, CellDistribution *distribution)
Compute the cell distribution corresponding to a partition.
void pack_distributed_entities(const Mesh &mesh, TDim tdim, const CellDistribution &distribution, std::vector< EntityPackage > &entities)
Helper function for packing distributed entities.
std::string string_from_range(const Iterator &begin, const Iterator &end)
Create a string representation of a range.
Definition: log.h:146
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58
std::vector< int > unpack_entities(const EntityPackage &entities, MeshBuilder &builder)
Unpacks the entities in an EntityPackage into a MeshBuilder.

◆ create_quadrature_type()

template<class DataType >
QuadratureType<DataType>* hiflow::create_quadrature_type ( const std::string &  name)

Factory function for quadrature types.

Definition at line 36 of file quadrature.cc.

37  {
38  if ( name == "GaussTetrahedron" )
39  {
40  return new QuadratureGaussTetrahedron<DataType>;
41  }
42  else if ( name == "GaussHexahedron" )
43  {
44  return new QuadratureGaussHexahedron<DataType>;
45  }
46  else if ( name == "EconomicalGaussHexahedron" )
47  {
48  return new QuadratureEconomicalGaussHexahedron<DataType>;
49  }
50  else if ( name == "GaussTriangle" )
51  {
52  return new QuadratureGaussTriangle<DataType>;
53  }
54  else if ( name == "GaussQuadrilateral" )
55  {
56  return new QuadratureGaussQuadrilateral<DataType>;
57  }
58  else if ( name == "EconomicalGaussQuadrilateral" )
59  {
60  return new QuadratureEconomicalGaussQuadrilateral<DataType>;
61  }
62  else if ( name == "GaussLine" )
63  {
64  return new QuadratureGaussLine<DataType>;
65  }
66  else if ( name == "GaussPyramid" )
67  {
68  return new QuadratureGaussPyramid<DataType>;
69  }
70  else
71  {
72  assert ( 0 );
73  }
74  return 0;
75  }

◆ CreateCmpPairs()

template<class T >
CmpPairs<T> hiflow::CreateCmpPairs ( const std::vector< T > &  v)

Creator function for CmpPairs.

Definition at line 54 of file sort_permutation.h.

Referenced by sortingPermutation().

55  {
56  return CmpPairs<T>( v );
57  }

◆ cross()

template<class DataType >
Vec<3, DataType> hiflow::cross ( const Vec< 3, DataType > &  v1,
const Vec< 3, DataType > &  v2 
)
inline

Computes the cross product of two 3d vectors.

Definition at line 252 of file vector_algebra.h.

Referenced by hiflow::doffem::FEType< LAD_high ::DataType >::is_point_on_subentity(), and normal().

253  {
254  Vec<3, DataType> v3;
255  v3[0] = v1[1] * v2[2] - v1[2] * v2[1];
256  v3[1] = v1[2] * v2[0] - v1[0] * v2[2];
257  v3[2] = v1[0] * v2[1] - v1[1] * v2[0];
258  return v3;
259  }

◆ det() [1/3]

template<class DataType >
DataType hiflow::det ( const Mat< 1, 1, DataType > &  m)
inline

◆ det() [2/3]

template<class DataType >
DataType hiflow::det ( const Mat< 2, 2, DataType > &  m)
inline

Determinant for 2x2 matrix.

Definition at line 675 of file vector_algebra.h.

676  {
677  return m ( 0, 0 ) * m ( 1, 1 ) - m ( 0, 1 ) * m ( 1, 0 );
678  }

◆ det() [3/3]

template<class DataType >
DataType hiflow::det ( const Mat< 3, 3, DataType > &  m)
inline

Determinant for 3x3 matrix.

Definition at line 683 of file vector_algebra.h.

684  {
685  return m ( 0, 0 ) * ( m ( 1, 1 ) * m ( 2, 2 ) - m ( 1, 2 ) * m ( 2, 1 ) )
686  - m ( 0, 1 ) * ( m ( 1, 0 ) * m ( 2, 2 ) - m ( 1, 2 ) * m ( 2, 0 ) )
687  + m ( 0, 2 ) * ( m ( 1, 0 ) * m ( 2, 1 ) - m ( 1, 1 ) * m ( 2, 0 ) );
688  }

◆ dot()

template<size_t N, class DataType >
Vec<N, DataType>::value_type hiflow::dot ( const Vec< N, DataType > &  v1,
const Vec< N, DataType > &  v2 
)
inline

Computes the scalar product of two vectors.

Definition at line 238 of file vector_algebra.h.

Referenced by hiflow::mesh::Tetrahedron::check_cell_geometry(), hiflow::polynomialchaos::PCGalerkinVector< DataType >::Dot(), hiflow::la::PCEVector< DataType >::Dot(), CPUsimple_lVector< ValueType >::Dot(), CPUopenmp_lVector< ValueType >::Dot(), CPUmkl_lVector< ValueType >::Dot(), CPUcblas_lVector< ValueType >::Dot(), hiflow::doffem::FEType< LAD_high ::DataType >::is_point_on_subentity(), norm(), and CPUmkl_lVector< ValueType >::Norm2().

239  {
240  typename Vec<N, DataType>::value_type res = typename Vec<N, DataType>::value_type ( );
241  for ( size_t i = 0; i < N; ++i )
242  {
243  res += v1[i] * v2[i];
244  }
245 
246  return res;
247  }

◆ extract_local_mesh()

mesh::MeshPtr hiflow::extract_local_mesh ( const mesh::MeshPtr  master_mesh,
const int  master_rank,
const MPI_Comm &  comm,
std::vector< int > &  partitioning,
mesh::IMPL  impl 
)

Definition at line 491 of file mesh_tools.cc.

References hiflow::mesh::compute_cell_distribution(), hiflow::mesh::compute_facet_from_cell_distribution(), hiflow::mesh::EntityPackage::gdim, hiflow::mesh::IMPL_DBVIEW, hiflow::mesh::IMPL_P4EST, LOG_DEBUG, LOG_ERROR, hiflow::mesh::EntityPackage::material_numbers, hiflow::mesh::CellDistribution::num_cells, hiflow::mesh::EntityPackage::offsets, hiflow::mesh::pack_distributed_entities(), string_from_range(), hiflow::mesh::EntityPackage::tdim, and hiflow::mesh::unpack_entities().

Referenced by partition_and_distribute_pXest().

496  {
497  int my_rank = -1, num_ranks = -2;
498  MPI_Comm_rank ( comm, &my_rank );
499  MPI_Comm_size ( comm, &num_ranks );
500  assert ( 0 <= my_rank );
501  assert ( 0 <= master_rank );
502  assert ( master_rank < num_ranks );
503  assert ( my_rank < num_ranks );
504 
505  // check that master_mesh is non-null iff we are on master process
506  assert ( master_mesh != 0 );
507  assert ( impl == mesh::IMPL_DBVIEW || impl == mesh::IMPL_P4EST );
508 
509  // get period
510  std::vector<MasterSlave> period ( 0 );
511  period = master_mesh->get_period ( );
512 
513  std::vector<EntityPackage> sent_entities;
514  EntityPackage my_entities;
515  std::vector<EntityPackage> sent_facet_entities;
516  EntityPackage my_facet_entities;
517  std::vector<int> num_entities_on_proc;
518  std::vector<int> num_facet_entities_on_proc;
519 
520  const TDim tdim = master_mesh->tdim ( );
521 
522  // compute distribution of cells from the partitioning
523  CellDistribution distribution;
524  compute_cell_distribution ( num_ranks, partitioning, &distribution );
525 
526  assert ( static_cast < int > ( distribution.num_cells.size ( ) ) == num_ranks );
527 
528  // compute distribution of facets from cell distribution
529  CellDistribution facet_distribution;
530  compute_facet_from_cell_distribution ( *master_mesh, distribution, &facet_distribution );
531 
532  // prepare sent entities
533  pack_distributed_entities ( *master_mesh, tdim, distribution, sent_entities );
534  pack_distributed_entities ( *master_mesh, tdim - 1, facet_distribution, sent_facet_entities );
535 
536  // use num_cells vector from distribution for num_entities_on_proc
537  num_entities_on_proc.swap ( distribution.num_cells );
538  num_facet_entities_on_proc.swap ( facet_distribution.num_cells );
539 
540  LOG_DEBUG ( 2, "num_entities_on_proc = "
541  << string_from_range ( num_entities_on_proc.begin ( ), num_entities_on_proc.end ( ) ) );
542  LOG_DEBUG ( 2, "num_facet_entities_on_proc = "
543  << string_from_range ( num_facet_entities_on_proc.begin ( ), num_facet_entities_on_proc.end ( ) ) );
544 
545  int my_num_entities = num_entities_on_proc[my_rank];
546  int my_num_facet_entities = num_facet_entities_on_proc[my_rank];
547 
548  // Extract cells
549  my_entities = sent_entities[my_rank];
550 
551  LOG_DEBUG ( 2, "Received " << my_entities.offsets.size ( ) << " cells on proc " << my_rank );
552 
553  // unpack the received part of the mesh into a builder
554  MeshBuilder* builder;
555  if ( impl == mesh::IMPL_DBVIEW )
556  {
557  builder = new MeshDbViewBuilder ( my_entities.tdim, my_entities.gdim, period );
558  }
559  if ( impl == mesh::IMPL_P4EST )
560  {
561 #ifdef WITH_P4EST
562  builder = new MeshPXestBuilder ( my_entities.tdim, my_entities.gdim, period );
563 #else
564  LOG_ERROR ( "Not compiled with p4ests support!" );
565  exit ( -1 );
566 #endif
567  }
568 
569  unpack_entities ( my_entities, *builder );
570 
571  // Extract facets
572  my_facet_entities = sent_facet_entities[my_rank];
573 
574  LOG_DEBUG ( 2, "Received " << my_facet_entities.offsets.size ( ) << " facets on proc " << my_rank );
575 
576  LOG_DEBUG ( 3, "Received material numbers "
577  << string_from_range ( my_facet_entities.material_numbers.begin ( ),
578  my_facet_entities.material_numbers.end ( ) )
579  << " on proc " << my_rank << "\n" );
580 
581  // unpack the received facets into a builder
582  unpack_entities ( my_facet_entities, *builder );
583 
584  // build the local mesh
585  MeshPtr recv_mesh ( builder->build ( ) );
586  delete builder;
587  return recv_mesh;
588  }
#define LOG_ERROR(stream)
Log an error message to the log "error".
Definition: log.h:233
#define LOG_DEBUG(lvl, stream)
Definition: log.h:221
int TDim
Definition: types.h:79
void compute_facet_from_cell_distribution(const Mesh &mesh, const CellDistribution &cell_distribution, CellDistribution *facet_distribution)
Compute the facet distribution corresponding to a cell distribution.
void compute_cell_distribution(const int num_partitions, const std::vector< int > &partitioning, CellDistribution *distribution)
Compute the cell distribution corresponding to a partition.
void pack_distributed_entities(const Mesh &mesh, TDim tdim, const CellDistribution &distribution, std::vector< EntityPackage > &entities)
Helper function for packing distributed entities.
std::string string_from_range(const Iterator &begin, const Iterator &end)
Create a string representation of a range.
Definition: log.h:146
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58
std::vector< int > unpack_entities(const EntityPackage &entities, MeshBuilder &builder)
Unpacks the entities in an EntityPackage into a MeshBuilder.

◆ find_dofs_and_coords_on_face()

template<class DataType >
void hiflow::find_dofs_and_coords_on_face ( const mesh::EntityIterator boundary_face,
const VectorSpace< DataType > &  space,
int  var,
std::vector< doffem::DofID > &  dof_ids,
std::vector< std::vector< DataType > > &  dof_points 
)

Finds the dofs and the coords on a given (boundary) facet.

Serves as a helper function for the function compute_dirichlet_dofs_and_values.

Parameters
[in]boundary_faceiterator on the boundary facets.
[in]spacespace object containing the mesh and the FE approximation.
[in]varvariable for which the dirichlet dofs should be set. The function can be called several times for vector-valued problems.
[out]dof_idsthe id:s of the dofs on the facet.
[out]dof_pointsthe coordinates of the dof id:s.

Definition at line 26 of file dirichlet_boundary_conditions.cc.

References hiflow::mesh::Entity::begin_incident(), hiflow::mesh::Mesh::begin_incident(), hiflow::VectorSpace< DataType >::dof(), hiflow::mesh::Mesh::end_incident(), find_dofs_and_coords_on_face< double >(), find_dofs_and_coords_on_face< float >(), hiflow::mesh::Mesh::find_entity(), hiflow::doffem::DegreeOfFreedom< DataType >::get_coord_on_subentity(), hiflow::doffem::DegreeOfFreedom< DataType >::get_dofs_on_subentity(), hiflow::mesh::Mesh::get_entity(), hiflow::VectorSpace< DataType >::mesh(), and hiflow::mesh::Mesh::tdim().

Referenced by compute_dirichlet_dofs_and_values().

30  {
31  using namespace mesh;
32  using namespace doffem;
33 
34  const Mesh& mesh = space.mesh ( );
35  const TDim tdim = mesh.tdim ( );
36 
37  // get id of boundary face
38  const Id boundary_id = boundary_face->id ( );
39 
40  // check if the boundary face exists and get the location where the entity
41  // number should be stored
42  int face_number;
43  const bool check = mesh.find_entity ( tdim - 1, boundary_id, &face_number );
44  assert ( check );
45 
46  // Get the face to be able to access to the data associated with the face
47  Entity face = mesh.get_entity ( tdim - 1, face_number );
48 
49 #ifndef NDEBUG
50  // Get the cell associated with the cell and check if only one cell was
51  // found
52  IncidentEntityIterator dbg_cell = mesh.begin_incident ( face, tdim );
53  assert ( dbg_cell != mesh.end_incident ( face, tdim ) );
54  assert ( ++dbg_cell == mesh.end_incident ( face, tdim ) );
55 #endif
56 
57  // reset the cell because it was changed in the assert above
58  IncidentEntityIterator cell = face.begin_incident ( tdim );
59 
60  // loop over all faces of the cell to get the local face index for
61  // identifying the dofs
62  int local_face_number = 0;
63  for ( IncidentEntityIterator global_face = cell->begin_incident ( tdim - 1 );
64  global_face != cell->end_incident ( tdim - 1 );
65  ++global_face )
66  {
67  // if the global face id equals the boundary id the local face index is
68  // found
69  if ( global_face->id ( ) == boundary_id )
70  {
71  break;
72  }
73  else
74  {
75  local_face_number++;
76  }
77  }
78 
79  assert ( local_face_number >= 0 &&
80  local_face_number < cell->cell_type ( ).num_regular_entities ( tdim - 1 ) );
81 
82  // Get dofs and coords
83  const DegreeOfFreedom<DataType>& dof = space.dof ( );
84 
85  dof.get_dofs_on_subentity ( var, cell->index ( ), tdim - 1, local_face_number,
86  dof_ids );
87  dof.get_coord_on_subentity ( var, cell->index ( ), tdim - 1, local_face_number,
88  dof_points );
89  }
Abstract base class for mesh implementations.
int Id
Type for representing entity Id:s. Id:s are arbitrary, non-negative integer values.
Definition: types.h:68
int TDim
Definition: types.h:79

◆ find_dofs_and_coords_on_face< double >()

template void hiflow::find_dofs_and_coords_on_face< double > ( const mesh::EntityIterator boundary_face,
const VectorSpace< double > &  space,
int  var,
std::vector< doffem::DofID > &  dof_ids,
std::vector< std::vector< double > > &  dof_points 
)

◆ find_dofs_and_coords_on_face< float >()

template void hiflow::find_dofs_and_coords_on_face< float > ( const mesh::EntityIterator boundary_face,
const VectorSpace< float > &  space,
int  var,
std::vector< doffem::DofID > &  dof_ids,
std::vector< std::vector< float > > &  dof_points 
)

◆ fixed_error_strategy()

void hiflow::fixed_error_strategy ( double  tol,
int  num_global_cells,
double  conv_order,
int  threshold,
int  coarsen_marker,
const std::vector< double > &  indicators,
std::vector< int > &  adapt_markers 
)

adapt mesh to obtain a desired accuracy: refine cell k if indicator(k) > tol / num_global_cells coarsen cell k if 2^conv_order * indicator(k) < tol / num_global_cells

Parameters
[in]toldesired accuracy
[in]num_global_cellsnumber of global cells in mesh
[in]conv_orderassumed convergence order of applied numerical scheme
[in]thresholdstart coarsening when more than #threshold cells are present in mesh
[in]coarsen_markercoarsen family l of cells k if {k Family(l)} coarsen_marker(k) <= #Family(l)
[in]indicatorserror indicators
[out]adapt_markersresulting adaption markers to be passed to refine routine of mesh

Definition at line 64 of file refinement_strategies.cc.

71  {
72  adapt_markers.resize ( indicators.size ( ), 0 );
73  double av_max_error = tol / num_global_cells;
74  int num_cells = indicators.size ( );
75 
76  for ( int c = 0; c < num_cells; ++c )
77  {
78  // mark cells for refinement
79  if ( indicators[c] > av_max_error )
80  {
81  adapt_markers[c] = 1;
82  }
83 
84  // mark cells for coarsening
85  if ( num_global_cells >= threshold )
86  {
87  if ( indicators[c] * std::pow ( 2.0, conv_order ) < av_max_error )
88  {
89  adapt_markers[c] = coarsen_marker;
90  }
91  }
92  }
93  }

◆ frob()

template<size_t N, class DataType >
DataType hiflow::frob ( const Mat< N, N, DataType > &  m1,
const Mat< N, N, DataType > &  m2 
)
inline

Computes the Frobenius product of two quadratic matrices.

Definition at line 867 of file vector_algebra.h.

868  {
869 
870  DataType res = 0.0;
871  assert ( N > 0 );
872  for ( size_t i = 0; i < N; ++i )
873  {
874 # pragma clang loop vectorize(enable)
875  for ( size_t k = 0; k < N; ++k )
876  {
877  res += m1 ( i, k ) * m2 ( i, k );
878  }
879  }
880  return res;
881  }

◆ gauss()

template<size_t M, size_t N, class DataType >
bool hiflow::gauss ( Mat< M, N, DataType > &  mat,
Vec< M, DataType > &  vec 
)
inline

Gaussian elimination of a linear system.

Definition at line 780 of file vector_algebra.h.

781  {
782  // Gaussian elimination with pivoting of a linear system of equations
783  // transforms the given Matrix and vector
784  // if the submatrix m[1:M,1:M] is regular, the solution of m[1:M,1:M] x = v
785  // ist stored into vec
786  // if the matrix consists of m = [m[1:M,1:M] Id_M], the invers of m
787  // is stored in the second half of the matrix
788 
789  // the current version needs to get equal or more columns than rows
790  assert ( N >= M );
791 
792  for ( size_t i = 0; i < M; ++i )
793  {
794  // find pivot row
795  int pivot = i;
796  for ( size_t p = i; p < M; ++p )
797  {
798  if ( std::abs ( mat ( pivot, i ) ) < std::abs ( mat ( p, i ) ) )
799  {
800  pivot = p;
801  }
802  }
803  // check if system is solvable
804  if ( std::abs ( mat ( pivot, i ) ) < COMPARISON_TOL )
805  {
806  return false;
807  }
808  // swap rows
809  if ( pivot != i )
810  {
811  for ( size_t n = i; n < N; ++n )
812  {
813  std::swap ( mat ( pivot, n ), mat ( i, n ) );
814  }
815  std::swap ( vec[pivot], vec[i] );
816  }
817  // reduce
818  vec[i] /= mat ( i, i );
819  for ( size_t n = N - 1; n >= i; --n )
820  {
821  mat ( i, n ) /= mat ( i, i );
822  }
823  // elimination forwards
824  for ( size_t m = i + 1; m < M; ++m )
825  {
826  vec[m] -= vec[i] * mat ( m, i );
827  for ( size_t n = N - 1; n >= i; --n )
828  {
829  mat ( m, n ) -= mat ( i, n ) * mat ( m, i );
830  }
831  }
832  }
833 
834  // elimination backwards
835  for ( int i = M - 1; i > 0; --i )
836  {
837  for ( int m = i - 1; m >= 0; --m )
838  {
839  vec[m] -= vec[i] * mat ( m, i );
840  for ( size_t n = N - 1; n >= i; --n )
841  {
842  mat ( m, n ) -= mat ( i, n ) * mat ( m, i );
843  }
844  }
845  }
846  return true;
847  }

◆ identity()

template<class DataType >
std::vector< DataType> hiflow::identity ( std::vector< DataType >  coord)

Definition at line 63 of file xdmf_visualization.h.

64  {
65  return coord;
66  }

◆ init_master_quadrature()

template<class DataType >
void hiflow::init_master_quadrature ( const Element< DataType > &  slave_elem,
const Element< DataType > &  master_elem,
const Quadrature< DataType > &  slave_quad,
Quadrature< DataType > &  master_quad 
)

Definition at line 142 of file dg_assembly.cc.

References hiflow::Element< DataType >::get_cell(), hiflow::Element< DataType >::get_cell_transformation(), hiflow::doffem::CellTransformation< DataType >::inverse(), hiflow::Quadrature< DataType >::set_custom_quadrature(), hiflow::Quadrature< DataType >::size(), hiflow::Quadrature< DataType >::w(), hiflow::doffem::CellTransformation< DataType >::x(), hiflow::Quadrature< DataType >::x(), hiflow::Quadrature< DataType >::y(), hiflow::doffem::CellTransformation< DataType >::y(), hiflow::Quadrature< DataType >::z(), and hiflow::doffem::CellTransformation< DataType >::z().

Referenced by hiflow::DefaultInterfaceQuadratureSelection< DataType >::operator()().

146  {
147  // Exit early if both elements are the same.
148  if ( master_elem.get_cell ( ).id ( ) == slave_elem.get_cell ( ).id ( ) )
149  {
150  master_quad = slave_quad; // copy quadrature (might not be necessary)
151  return;
152  }
153 
154  const doffem::CellTransformation<DataType>* Ts = slave_elem.get_cell_transformation ( );
155  const doffem::CellTransformation<DataType>* Tm = master_elem.get_cell_transformation ( );
156 
157  const int num_q = slave_quad.size ( );
158  std::vector<DataType> xc ( num_q, 0. ), yc ( num_q, 0. ), zc ( num_q, 0. ), wgt ( num_q, 0. );
159 
160  const int dim = slave_elem.get_cell ( ).tdim ( );
161 
162  std::vector<DataType> ref_pt ( dim ), phys_pt ( dim );
163 
164  if ( dim == 2 )
165  {
166  for ( size_t q = 0; q != num_q; ++q )
167  {
168  // reference point
169  ref_pt[0] = slave_quad.x ( q );
170  ref_pt[1] = slave_quad.y ( q );
171 
172  // physical point
173  phys_pt[0] = Ts->x ( ref_pt );
174  phys_pt[1] = Ts->y ( ref_pt );
175 
176  // reference point on master cell
177  Tm->inverse ( phys_pt[0], phys_pt[1], xc[q], yc[q] );
178 
179  // weight
180  wgt[q] = slave_quad.w ( q );
181  }
182 
183  }
184  else if ( dim == 3 )
185  {
186  for ( size_t q = 0; q != num_q; ++q )
187  {
188  // reference point
189 
190  ref_pt[0] = slave_quad.x ( q );
191  ref_pt[1] = slave_quad.y ( q );
192  ref_pt[2] = slave_quad.z ( q );
193 
194  // physical point
195  phys_pt[0] = Ts->x ( ref_pt );
196  phys_pt[1] = Ts->y ( ref_pt );
197  phys_pt[2] = Ts->z ( ref_pt );
198  // reference point on master cell
199  Tm->inverse ( phys_pt[0], phys_pt[1], phys_pt[2], xc[q], yc[q], zc[q] );
200 
201  // weight
202  wgt[q] = slave_quad.w ( q );
203  }
204  }
205  master_quad.set_custom_quadrature ( xc, yc, zc, wgt );
206  }

◆ init_traversal()

template<class DataType >
void hiflow::init_traversal ( const VectorSpace< DataType > &  space,
std::vector< int > &  iteration_order 
)
inline

Initialze traversal.

Definition at line 227 of file generic_assembly_algorithm.h.

References hiflow::VectorSpace< DataType >::mesh(), hiflow::mesh::Mesh::num_entities(), and hiflow::mesh::Mesh::tdim().

Referenced by hiflow::AssemblyAlgorithmBase< AlgorithmType, StandardBoundaryScalarAssembly< AlgorithmType, DataType >, DataType >::AssemblyAlgorithmBase().

228  {
229  const mesh::Mesh& mesh = space.mesh ( );
230  const int num_elements = mesh.num_entities ( mesh.tdim ( ) );
231 
232  iteration_order.resize ( num_elements );
233  for ( size_t i = 0; i != num_elements; ++i )
234  {
235  iteration_order[i] = i;
236  }
237  }

◆ initialize_linear_algebra_objects()

template<class DataType >
void hiflow::initialize_linear_algebra_objects ( const VectorSpace< DataType > &  space,
const GlobalAssembler< DataType > &  global_asm,
la::Couplings< DataType > &  couplings,
typename GlobalAssembler< DataType >::GlobalMatrix &  matrix 
)

Initialize linear algebra objects for global assembly.

Definition at line 37 of file assembly.cc.

References hiflow::GlobalAssembler< DataType >::compute_sparsity_structure(), hiflow::SparsityStructure::diagonal_cols, hiflow::SparsityStructure::diagonal_rows, hiflow::la::Couplings< DataType >::InitializeCouplings(), hiflow::SparsityStructure::off_diagonal_cols, hiflow::SparsityStructure::off_diagonal_rows, and vec2ptr().

41  {
42  SparsityStructure sparsity;
43  global_asm.compute_sparsity_structure ( space, sparsity );
44 
45  couplings.InitializeCouplings ( sparsity.off_diagonal_rows, sparsity.off_diagonal_cols );
46 
47  matrix.InitStructure (
48  vec2ptr ( sparsity.diagonal_rows ),
49  vec2ptr ( sparsity.diagonal_cols ),
50  sparsity.diagonal_rows.size ( ),
51  vec2ptr ( sparsity.off_diagonal_rows ),
52  vec2ptr ( sparsity.off_diagonal_cols ),
53  sparsity.off_diagonal_rows.size ( ) );
54  }
T * vec2ptr(std::vector< T > &vec)
Conversion from vector to pointer to first element.
Definition: pointers.h:57

◆ InitStructure()

template<class DataType >
void hiflow::InitStructure ( const VectorSpace< DataType > &  space,
std::vector< int > *  rows_diag,
std::vector< int > *  cols_diag,
std::vector< int > *  rows_offdiag,
std::vector< int > *  cols_offdiag,
std::vector< std::vector< bool > > *  coupling_vars 
)
inline

Set up non zero structure in order to assemble matrix. (row/col) pairs correspond to components in the matrix to set Checks for duplicates.

Parameters
spacevector space
rows_diagglobal row numbers for diagonal block
cols_diagglobal column numbers for diagonal block
rows_offdiagglobal row numbers for offdiagonal block
cols_offdiagglobal column numbers for offdiagonal block
[in]coupling_vars2D array indicating the coupling of vars. Rows (first index) belong to test variables, columns (second index) belong to trial variables. If entry (i, j) is set to true, test variable i couples with trial variable j, and the corresponding block is contained in the sparsity structure. Otherwise, the block is skipped, resulting in a sparser structure. If this argument is not passed or is empty, full coupling of all variables is assumed. All rows and columns need to have the size of space.get_nb_var().

Definition at line 59 of file integration_utilities.h.

References hiflow::mesh::Mesh::begin(), pretty_print::begin(), hiflow::VectorSpace< DataType >::dof(), hiflow::mesh::Mesh::end(), pretty_print::end(), hiflow::VectorSpace< DataType >::get_dim(), hiflow::doffem::DofPartition< DataType >::get_my_subdomain(), hiflow::VectorSpace< DataType >::get_nb_var(), hiflow::VectorSpace< DataType >::GetDofIndices(), hiflow::doffem::DofPartition< DataType >::global2local(), hiflow::doffem::DofPartition< DataType >::is_dof_on_sd(), hiflow::doffem::DofPartition< DataType >::local2global(), hiflow::VectorSpace< DataType >::mesh(), and hiflow::doffem::DofPartition< DataType >::ndofs_on_sd().

Referenced by hiflow::StandardGlobalAssembler< DataType >::compute_sparsity_structure_impl(), and hiflow::la::CoupledVector< DataType >::Init().

65  {
66 
67  // Assert correct size of coupling_vars
68 
69  assert ( coupling_vars->size ( ) == space.get_nb_var ( ) );
70  for ( int i = 0, i_e = space.get_nb_var ( ); i != i_e; ++i )
71  {
72  assert ( ( *coupling_vars )[i].size ( ) == space.get_nb_var ( ) );
73  }
74 
75 # ifdef OUTPUT_STRUCT
76  // CSV writer for visual check of sparsity structure
77  CSVWriter<int> writer ( "sparsity.csv" );
78 
79  std::vector<std::string> names;
80  names.push_back ( "i" );
81  names.push_back ( "j" );
82  names.push_back ( "val" );
83 
84  writer.Init ( names );
85 
86  std::vector<int> values ( 3, -1 );
87 # endif
88 
89  // total number of own dofs
90  int ndof_total = space.dof ( ).ndofs_on_sd ( space.dof ( ).get_my_subdomain ( ) );
91 
92  // a set of columns for every row
93  // std::vector< std::set<int> > raw_struct_diag(ndof_total);
94  // std::vector< std::set<int> > raw_struct_offdiag(ndof_total);
95  std::vector< SortedArray<int> > raw_struct_diag ( ndof_total );
96  std::vector< SortedArray<int> > raw_struct_offdiag ( ndof_total );
97 
98  std::vector<int> dof_ind_test, dof_ind_trial;
99  int local_dof_i;
100 
101  // loop over every cell (including ghost cells)
102  typename VectorSpace<DataType>::MeshEntityIterator mesh_it = space.mesh ( ).begin ( space.get_dim ( ) );
103  typename VectorSpace<DataType>::MeshEntityIterator e_mesh_it = space.mesh ( ).end ( space.get_dim ( ) );
104  while ( mesh_it != e_mesh_it )
105  {
106  // loop over test variables
107  for ( int test_var = 0, tv_e = space.get_nb_var ( ); test_var != tv_e; ++test_var )
108  {
109  // get dof indices for test variable
110  space.GetDofIndices ( test_var, *mesh_it, &dof_ind_test );
111 
112  // loop over trial variables
113  for ( int trial_var = 0, vt_e = space.get_nb_var ( ); trial_var != vt_e; ++trial_var )
114  {
115 
116  // check whether test_var and trial_var couple
117  if ( ( *coupling_vars )[test_var][trial_var] )
118  {
119 
120  // get dof indices for trial variable
121  space.GetDofIndices ( trial_var, *mesh_it, &dof_ind_trial );
122 
123  // detect couplings
124  for ( size_t i = 0, i_e = dof_ind_test.size ( ); i != i_e; ++i )
125  {
126  const int di_i = dof_ind_test[i];
127 
128  // if my row
129  if ( space.dof ( ).is_dof_on_sd ( di_i ) )
130  {
131 
132  space.dof ( ).global2local ( di_i, &local_dof_i );
133 
134  for ( size_t j = 0, j_e = dof_ind_trial.size ( ); j != j_e; ++j )
135  {
136  const int di_j = dof_ind_trial[j];
137 
138  // diagonal coupling (my col)
139  if ( space.dof ( ).is_dof_on_sd ( di_j ) )
140  {
141  raw_struct_diag[local_dof_i].find_insert ( di_j );
142  }
143  else
144  {
145  // nondiagonal coupling (not my col)
146  raw_struct_offdiag[local_dof_i].find_insert ( di_j );
147  }
148  } // endif my row
149 
150  } // for (int j=0;...
151  } // for (int i=0;...
152  }
153  }
154  }
155  // next cell
156  ++mesh_it;
157  } // while (mesh_it != ...
158 
159 # ifdef OUTPUT_STRUCT
160  for ( size_t k = 0, k_e = raw_struct_diag.size ( ); k != k_e; ++k )
161  {
162  values[0] = k;
163  for ( size_t l = 0, l_e = raw_struct_diag[k].size ( ); l != l_e; ++l )
164  {
165  values[1] = raw_struct_diag[k][l];
166  values[2] = 1;
167  writer.write ( values );
168  }
169  }
170 
171  // compute nnz for nondiagonal block
172  for ( size_t k = 0, k_e = raw_struct_offdiag.size ( ); k != k_e; ++k )
173  {
174  values[0] = k;
175  for ( size_t l = 0, l_e = raw_struct_offdiag[k].size ( ); l != l_e; ++l )
176  {
177  values[1] = raw_struct_offdiag[k][l];
178  values[2] = 1;
179  writer.write ( values );
180  }
181  }
182 # endif
183 
184  // compute nnz for diagonal block
185  int nnz_diag = 0;
186  for ( size_t k = 0, k_e = raw_struct_diag.size ( ); k != k_e; ++k )
187  {
188  nnz_diag += raw_struct_diag[k].size ( );
189  }
190 
191  // compute nnz for nondiagonal block
192  int nnz_offdiag = 0;
193  for ( size_t k = 0, k_e = raw_struct_offdiag.size ( ); k != k_e; ++k )
194  {
195  nnz_offdiag += raw_struct_offdiag[k].size ( );
196  }
197 
198  // now create rows, cols
199  rows_diag->resize ( nnz_diag );
200  cols_diag->resize ( nnz_diag );
201  rows_offdiag->resize ( nnz_offdiag );
202  cols_offdiag->resize ( nnz_offdiag );
203 
204  // now create row/col indices for diagonal block
205  int ind = 0;
206  int global_dof_i = 0;
207 
208  for ( size_t i = 0; i != ndof_total; ++i )
209  {
210  // now going through row i
211  space.dof ( ).local2global ( i, &global_dof_i );
212 
214  it = raw_struct_diag[i].begin ( ),
215  end = raw_struct_diag[i].end ( );
216  it != end; ++it )
217  {
218 
219  ( *rows_diag )[ind] = global_dof_i;
220  ( *cols_diag )[ind] = *it;
221 
222  // increase index
223  ++ind;
224  }
225  }
226  assert ( ind == nnz_diag );
227 
228  // now create row/col indices for offdiagonal block
229  ind = 0;
230  for ( size_t i = 0; i != ndof_total; ++i )
231  {
232  // now going through row i
233  space.dof ( ).local2global ( i, &global_dof_i );
234 
236  it = raw_struct_offdiag[i].begin ( ),
237  end = raw_struct_offdiag[i].end ( );
238  it != end; ++it )
239  {
240 
241  ( *rows_offdiag )[ind] = global_dof_i;
242  ( *cols_offdiag )[ind] = *it;
243  // increase index
244  ++ind;
245  }
246  }
247  assert ( ind == nnz_offdiag );
248  }
Class for handling CSV files. Provides functionality to create, write and read CSV files...
Definition: csv_writer.h:30
array_type::const_iterator const_iterator
Definition: sorted_array.h:46
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type begin(const T &c)

◆ interpolate_attribute()

bool hiflow::interpolate_attribute ( const MeshPtr  parent_mesh,
const std::string  parent_attribute_name,
MeshPtr  child_mesh 
)

Interpolate attribute from parent mesh to child mesh (new attributes in neighborhood are interpolated if possible by neighbor values)

Definition at line 726 of file mesh_tools.cc.

References hiflow::mesh::Entity::begin_incident(), hiflow::mesh::Entity::end_incident(), hiflow::mesh::Entity::get(), hiflow::mesh::Entity::id(), and LOG_DEBUG.

727  {
728  // same as copy, but interpolate values from the neighbors
729  assert ( child_mesh != 0 );
730  assert ( parent_mesh != 0 );
731  assert ( child_mesh->tdim ( ) == parent_mesh->tdim ( ) );
732 
733  for ( int i = 0; i <= parent_mesh->tdim ( ); ++i )
734  {
735  // TODO(Thomas): double for now, if not, return false ->
736  // to check (dynamic_cast?!)
737  AttributePtr double_parent_attribute;
738  try
739  {
740  double_parent_attribute = parent_mesh->get_attribute ( parent_attribute_name, i );
741  }
742  catch ( MissingAttributeException )
743  {
744  // Attribute <name> is missing!
745  std::cerr << "...for topological dimension " << i << ".\n";
746  continue;
747  }
748  std::vector<double> double_attribute_vector ( child_mesh->num_entities ( i ), 0.0 );
749 
750  // set this, to use later
751  double mean = 0.0; //double_parent_attribute->get_double_value(0);
752 
753  std::vector<EntityNumber> index_to_interpolate;
754 
755  for ( int j = 0; j < child_mesh->num_entities ( i ); ++j )
756  {
757  // get index of entity in parent mesh
758  EntityNumber index_parent;
759  Id child_id = child_mesh->get_id ( i, j );
760  // assume same database -> ids fit!
761  // if not, return false, if they don:t fit, but exist
762  //-> undefined behavior...
763  bool found = parent_mesh->find_entity ( i, child_id, &index_parent );
764 
765  if ( found )
766  {
767  double_attribute_vector[j] = double_parent_attribute->get_double_value ( index_parent );
768  }
769  else
770  {
771  // store index and interpolate later...
772  index_to_interpolate.push_back ( j );
773  }
774  }
775 
776  for ( std::vector<EntityNumber>::const_iterator iti = index_to_interpolate.begin ( );
777  iti != index_to_interpolate.end ( ); ++iti )
778  {
779  Entity entity_to_interpolate = child_mesh->get_entity ( i, *iti );
780 
781  // iterate over incidents to this entity, gather
782  // attributes, and take mean value (perhaps consider
783  // weighted mean as well)
784 
785  // treat this in a special way, since 0->0
786  // connectivity doesn:t exist in mesh
787  int counter;
788  double gather;
789 
790  if ( i == 0 )
791  {
792  IncidentEntityIterator iei = entity_to_interpolate.begin_incident ( child_mesh->tdim ( ) );
793  counter = 0;
794  gather = 0.0;
795  for (; iei != entity_to_interpolate.end_incident ( child_mesh->tdim ( ) ); ++iei )
796  {
797  VertexIdIterator vertex_id_it = iei->begin_vertex_ids ( );
798  for (; vertex_id_it != iei->end_vertex_ids ( ); ++vertex_id_it )
799  {
800  if ( entity_to_interpolate.id ( ) == *vertex_id_it )
801  {
802  continue;
803  }
804  EntityNumber vertex_index;
805  parent_mesh->find_entity ( 0, *vertex_id_it, &vertex_index );
806  Entity other_vertex = parent_mesh->get_entity ( 0, vertex_index );
807  double tmp;
808 
809  try
810  {
811  ++counter;
812  other_vertex.get ( parent_attribute_name, &tmp );
813  }
814  catch ( MissingAttributeException )
815  {
816  --counter;
817  tmp = 0.0;
818  }
819  gather += tmp;
820  }
821  }
822  }
823  else
824  {
825  IncidentEntityIterator iei = entity_to_interpolate.begin_incident ( i );
826  counter = 0;
827  gather = 0.0;
828  for (; iei != entity_to_interpolate.end_incident ( i ); ++iei )
829  {
830  double tmp;
831  try
832  {
833  iei->get ( parent_attribute_name, &tmp );
834  ++counter;
835  }
836  catch ( MissingAttributeException )
837  {
838  tmp = 0.0;
839  }
840  gather += tmp;
841  }
842  }
843  // reset mean if possible, take old value else
844  if ( counter != 0 ) mean = gather / counter;
845  double_attribute_vector[*iti] = mean;
846  }
847  assert ( static_cast < int > ( double_attribute_vector.size ( ) ) == child_mesh->num_entities ( i ) );
848  AttributePtr double_attribute = AttributePtr ( new DoubleAttribute ( double_attribute_vector ) );
849  child_mesh->add_attribute ( parent_attribute_name, i, double_attribute );
850  LOG_DEBUG ( 1, "Added attribute " << parent_attribute_name << " of dimension " << i << " to mesh." );
851  }
852  return true;
853  }
int Id
Type for representing entity Id:s. Id:s are arbitrary, non-negative integer values.
Definition: types.h:68
#define LOG_DEBUG(lvl, stream)
Definition: log.h:221
std::vector< Id >::const_iterator VertexIdIterator
Iterator for sequences of vertex id:s.
Definition: types.h:95
int EntityNumber
Definition: types.h:72
SharedPtr< Attribute >::Type AttributePtr
Definition: attributes.h:52

◆ interpolate_constrained_vector()

template<class DataType >
void hiflow::interpolate_constrained_vector ( const VectorSpace< DataType > &  space,
typename GlobalAssembler< DataType >::GlobalVector &  vector 
)

Definition at line 57 of file assembly.cc.

References hiflow::VectorSpace< DataType >::dof(), hiflow::doffem::DegreeOfFreedom< DataType >::dof_interpolation(), pretty_print::end(), hiflow::la::Vector< DataType >::GetValues(), hiflow::doffem::DofPartition< DataType >::is_dof_on_sd(), LOG_INFO, and hiflow::la::Vector< DataType >::SetValues().

Referenced by hiflow::FEInterpolationLagrange< LAD, DIM >::interpolate().

58  {
59  // TODO: necessary to take sub-domain into account here?
60 
61  const doffem::DofInterpolation& interp = space.dof ( ).dof_interpolation ( );
62 
63  const size_t num_constrained_dofs = interp.size ( );
64 
65  // return early if there are no constrained dofs
66  if ( num_constrained_dofs == 0 )
67  {
68  return;
69  }
70 
71  std::vector<int> constrained_dofs;
72  constrained_dofs.reserve ( num_constrained_dofs );
73  std::vector<DataType> constrained_values;
74  constrained_values.reserve ( num_constrained_dofs );
75 
76  std::vector<int> dependencies;
77  std::vector<DataType> coefficients;
78  std::vector<DataType> dependency_values;
79 
80  for ( doffem::DofInterpolation::const_iterator it = interp.begin ( ), end = interp.end ( ); it != end; ++it )
81  {
82  if ( space.dof ( ).is_dof_on_sd ( it->first ) )
83  {
84 
85  const size_t num_dependencies = it->second.size ( );
86  // probably should not happen, but we check to avoid later problems
87  if ( num_dependencies > 0 )
88  {
89 
90  dependencies.resize ( num_dependencies, -1 );
91  coefficients.resize ( it->second.size ( ), 0. );
92  dependency_values.resize ( num_dependencies, 0. );
93 
94  for ( size_t i = 0; i != num_dependencies; ++i )
95  {
96  dependencies[i] = it->second[i].first; // id of dependencies
97  coefficients[i] = it->second[i].second; // coefficient of dependencies
98  }
99 
100  // get values of dependency dofs from vector
101  vector.GetValues ( &dependencies.front ( ), num_dependencies, &dependency_values.front ( ) );
102 
103  // compute dot product of dependency_values and coefficients
104  DataType val = 0.;
105  for ( size_t i = 0; i != num_dependencies; ++i )
106  {
107  val += coefficients[i] * dependency_values[i];
108  }
109 
110  // store information
111  constrained_dofs.push_back ( it->first );
112  constrained_values.push_back ( val );
113  }
114  else
115  {
116  LOG_INFO ( "Constrained DoF without dependencies found", true );
117  exit ( -1 );
118  }
119  }
120 
121  }
122 
123  // write constrained dofs to vector
124  vector.SetValues ( &constrained_dofs.front ( ), constrained_dofs.size ( ), &constrained_values.front ( ) );
125  }
#define LOG_INFO(name, stream)
Definition: log.h:246
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)

◆ interpolate_constrained_vector< double >()

template void hiflow::interpolate_constrained_vector< double > ( const VectorSpace< double > &  space,
GlobalAssembler< double >::GlobalVector &  vector 
)

◆ interpolate_constrained_vector< float >()

template void hiflow::interpolate_constrained_vector< float > ( const VectorSpace< float > &  space,
GlobalAssembler< float >::GlobalVector &  vector 
)

◆ inv() [1/3]

template<class DataType >
void hiflow::inv ( const Mat< 1, 1, DataType > &  m,
Mat< 1, 1, DataType > &  m_inv 
)
inline

Inverse of 1x1 matrix.

Definition at line 693 of file vector_algebra.h.

Referenced by hiflow::doffem::CellTransformation< DataType >::inverse_newton_2d(), and hiflow::doffem::CellTransformation< DataType >::inverse_newton_3d().

694  {
695  m_inv ( 0, 0 ) = 1. / m ( 0, 0 );
696  }

◆ inv() [2/3]

template<class DataType >
void hiflow::inv ( const Mat< 2, 2, DataType > &  m,
Mat< 2, 2, DataType > &  m_inv 
)
inline

Inverse of 2x2 matrix.

Definition at line 701 of file vector_algebra.h.

References det().

702  {
703  typename Mat<2, 2, DataType>::value_type d = det ( m );
704  assert ( d != 0. );
705  m_inv ( 0, 0 ) = m ( 1, 1 ) / d;
706  m_inv ( 0, 1 ) = -m ( 0, 1 ) / d;
707  m_inv ( 1, 0 ) = -m ( 1, 0 ) / d;
708  m_inv ( 1, 1 ) = m ( 0, 0 ) / d;
709  }
DataType det(const Mat< 3, 3, DataType > &m)
Determinant for 3x3 matrix.

◆ inv() [3/3]

template<class DataType >
void hiflow::inv ( const Mat< 3, 3, DataType > &  m,
Mat< 3, 3, DataType > &  m_inv 
)
inline

Inverse of 3x3 matrix.

Definition at line 714 of file vector_algebra.h.

References det().

715  {
716  // compute determinant
717  const DataType d = det ( m );
718  assert ( d != static_cast < DataType > ( 0 ) );
719 
720  m_inv ( 0, 0 ) = ( m ( 1, 1 ) * m ( 2, 2 ) - m ( 1, 2 ) * m ( 2, 1 ) ) / d;
721  m_inv ( 0, 1 ) = -( m ( 0, 1 ) * m ( 2, 2 ) - m ( 0, 2 ) * m ( 2, 1 ) ) / d;
722  m_inv ( 0, 2 ) = ( m ( 0, 1 ) * m ( 1, 2 ) - m ( 0, 2 ) * m ( 1, 1 ) ) / d;
723 
724  m_inv ( 1, 0 ) = -( m ( 1, 0 ) * m ( 2, 2 ) - m ( 1, 2 ) * m ( 2, 0 ) ) / d;
725  m_inv ( 1, 1 ) = ( m ( 0, 0 ) * m ( 2, 2 ) - m ( 0, 2 ) * m ( 2, 0 ) ) / d;
726  m_inv ( 1, 2 ) = -( m ( 0, 0 ) * m ( 1, 2 ) - m ( 0, 2 ) * m ( 1, 0 ) ) / d;
727 
728  m_inv ( 2, 0 ) = ( m ( 1, 0 ) * m ( 2, 1 ) - m ( 1, 1 ) * m ( 2, 0 ) ) / d;
729  m_inv ( 2, 1 ) = -( m ( 0, 0 ) * m ( 2, 1 ) - m ( 0, 1 ) * m ( 2, 0 ) ) / d;
730  m_inv ( 2, 2 ) = ( m ( 0, 0 ) * m ( 1, 1 ) - m ( 0, 1 ) * m ( 1, 0 ) ) / d;
731  }
DataType det(const Mat< 3, 3, DataType > &m)
Determinant for 3x3 matrix.

◆ invTransp() [1/3]

template<class DataType >
void hiflow::invTransp ( const Mat< 1, 1, DataType > &  m,
Mat< 1, 1, DataType > &  m_inv 
)
inline

Inverse-Transpose of 1x1 matrix.

Definition at line 736 of file vector_algebra.h.

Referenced by hiflow::EvalInvTranspose< DIM, DataType >::operator()().

737  {
738  m_inv ( 0, 0 ) = 1. / m ( 0, 0 );
739  }

◆ invTransp() [2/3]

template<class DataType >
void hiflow::invTransp ( const Mat< 2, 2, DataType > &  m,
Mat< 2, 2, DataType > &  m_inv 
)
inline

Inverse-Transpose of 2x2 matrix.

Definition at line 744 of file vector_algebra.h.

References det().

745  {
746  typename Mat<2, 2, DataType>::value_type d = det ( m );
747  assert ( d != 0. );
748  m_inv ( 0, 0 ) = m ( 1, 1 ) / d;
749  m_inv ( 0, 1 ) = -m ( 1, 0 ) / d;
750  m_inv ( 1, 0 ) = -m ( 0, 1 ) / d;
751  m_inv ( 1, 1 ) = m ( 0, 0 ) / d;
752  }
DataType det(const Mat< 3, 3, DataType > &m)
Determinant for 3x3 matrix.

◆ invTransp() [3/3]

template<class DataType >
void hiflow::invTransp ( const Mat< 3, 3, DataType > &  m,
Mat< 3, 3, DataType > &  m_inv 
)
inline

Inverse-Transpose of 3x3 matrix.

Definition at line 757 of file vector_algebra.h.

References det().

758  {
759  // copy into inverse matrix
760  // compute determinant
761  const DataType d = det ( m );
762  assert ( d != static_cast < DataType > ( 0 ) );
763 
764  m_inv ( 0, 0 ) = ( m ( 1, 1 ) * m ( 2, 2 ) - m ( 1, 2 ) * m ( 2, 1 ) ) / d;
765  m_inv ( 0, 1 ) = -( m ( 1, 0 ) * m ( 2, 2 ) - m ( 1, 2 ) * m ( 2, 0 ) ) / d;
766  m_inv ( 0, 2 ) = ( m ( 1, 0 ) * m ( 2, 1 ) - m ( 1, 1 ) * m ( 2, 0 ) ) / d;
767 
768  m_inv ( 1, 0 ) = -( m ( 0, 1 ) * m ( 2, 2 ) - m ( 0, 2 ) * m ( 2, 1 ) ) / d;
769  m_inv ( 1, 1 ) = ( m ( 0, 0 ) * m ( 2, 2 ) - m ( 0, 2 ) * m ( 2, 0 ) ) / d;
770  m_inv ( 1, 2 ) = -( m ( 0, 0 ) * m ( 2, 1 ) - m ( 0, 1 ) * m ( 2, 0 ) ) / d;
771 
772  m_inv ( 2, 0 ) = ( m ( 0, 1 ) * m ( 1, 2 ) - m ( 0, 2 ) * m ( 1, 1 ) ) / d;
773  m_inv ( 2, 1 ) = -( m ( 0, 0 ) * m ( 1, 2 ) - m ( 0, 2 ) * m ( 1, 0 ) ) / d;
774  m_inv ( 2, 2 ) = ( m ( 0, 0 ) * m ( 1, 1 ) - m ( 0, 1 ) * m ( 1, 0 ) ) / d;
775  }
DataType det(const Mat< 3, 3, DataType > &m)
Determinant for 3x3 matrix.

◆ load_mesh()

mesh::MeshPtr hiflow::load_mesh ( std::string  filename,
const MPI_Comm &  comm,
mesh::IMPL  impl 
)

Load a mesh from a hdf5 file.

Definition at line 233 of file mesh_tools.cc.

References compute_ghost_cells_pXest(), hiflow::mesh::MeshPXest::get_history_index(), hiflow::mesh::IMPL_DBVIEW, hiflow::mesh::IMPL_P4EST, hiflow::mesh::IMPL_REFINED, hiflow::mesh::MeshDbView::load(), hiflow::mesh::MeshPXest::load(), hiflow::mesh::MeshPXest::set_db(), hiflow::mesh::MeshDbView::set_db(), and hiflow::mesh::RefinedMeshDbView::set_history().

Referenced by hiflow::DynamicMeshHandler< LAD, MESH_IMPL, DIM >::load_mesh_from_file().

234  {
235 #ifdef WITH_HDF5
236  std::size_t pos_suffix = filename.find_last_of ( "." );
237 
238  std::string filename_without_suffix = filename.substr ( 0, pos_suffix );
239 
240  assert ( !filename_without_suffix.empty ( ) );
241 
242  std::string suffix = ".h5";
243  filename = filename_without_suffix + suffix;
244 
245  int* tdimptr;
246  int* gdimptr;
247  int tdim, gdim;
248  {
249  H5FilePtr file_ptr ( new H5File ( filename, "r", comm ) );
250  //SETTING UP HDF5 GROUP
251  std::stringstream groupname;
252  groupname << "Mesh";
253  H5GroupPtr group_ptr ( new H5Group ( file_ptr, groupname.str ( ), "r" ) );
254  int dummy;
255  read_array_parallel ( group_ptr, "tdim", tdimptr, dummy, comm );
256  assert(dummy == 1);
257  read_array_parallel ( group_ptr, "gdim", gdimptr, dummy, comm );
258  assert(dummy == 1);
259  }
260  tdim = *tdimptr;
261  gdim = *gdimptr;
262  delete tdimptr;
263  delete gdimptr;
264 
265  MeshPtr mesh;
266 
267  if ( impl == mesh::IMPL_P4EST )
268  {
269 
270  MeshPXestDatabasePtr pXest_database ( new MeshPXestDatabase ( tdim, gdim ) );
271  pXest_database->load ( filename, comm );
272  int num_meshes = 0;
273  int history_index = -1;
274 
275  {
276  H5FilePtr file_ptr ( new H5File ( filename, "r", comm ) );
277  //SETTING UP HDF5 GROUP
278  std::stringstream groupname;
279  groupname << "HistoryMeshs";
280  H5GroupPtr group_ptr ( new H5Group ( file_ptr, groupname.str ( ), "r" ) );
281  int dummy;
282  int* buffer;
283  read_array_parallel ( group_ptr, "num_history_meshes", buffer, dummy, comm );
284  assert(dummy == 1);
285  num_meshes = *buffer;
286  delete buffer;
287  assert ( num_meshes > 0 );
288 
289  read_array_parallel ( group_ptr, "history_index", buffer, dummy, comm );
290  assert(dummy == 1);
291  history_index = *buffer;
292  delete buffer;
293  assert ( history_index > -1 );
294  }
295 
296  for ( int i = 0; i < num_meshes; ++i )
297  {
298  MeshPXest* pXest_ptr = new MeshPXest ( tdim, gdim );
299  std::stringstream filenamei;
300  filenamei << filename_without_suffix << "." << i << suffix;
301  pXest_ptr->load ( filenamei.str ( ), comm );
302  pXest_ptr->set_db ( pXest_database );
303 
304  int temp_history_index = pXest_ptr->get_history_index ( );
305  if ( temp_history_index == history_index )
306  mesh = pXest_ptr;
307 
308  pXest_database->set_mesh ( MeshPtr ( pXest_ptr ), temp_history_index );
309 
310  }
311  if(pXest_database->get_layer_width ( ) > 0)
312  compute_ghost_cells_pXest ( *mesh, comm, pXest_database->get_layer_width ( ) );
313  }
314  else if ( impl == mesh::IMPL_REFINED )
315  {
316  MeshDatabasePtr database ( new MeshDatabase ( tdim, gdim ) );
317  database->load ( filename, comm );
318  RefinedMeshDbView* refined_mesh_ptr = new RefinedMeshDbView ( tdim, gdim );
319  refined_mesh_ptr->MeshDbView::load ( filename, comm );
320  refined_mesh_ptr->set_db ( database );
321 
322  int num_meshes = 0;
323  {
324  H5FilePtr file_ptr ( new H5File ( filename, "r", comm ) );
325  //SETTING UP HDF5 GROUP
326  std::stringstream groupname;
327  groupname << "RefinedMeshDbView";
328  H5GroupPtr group_ptr ( new H5Group ( file_ptr, groupname.str ( ), "r" ) );
329  int dummy;
330  int* buffer;
331  read_array_parallel ( group_ptr, "num_history_meshes", buffer, dummy, comm );
332  assert(dummy == 1);
333  num_meshes = *buffer;
334  delete buffer;
335  }
336  std::vector<ConstMeshPtr> history_meshes ( num_meshes );
337  for ( int i = 0; i < num_meshes; ++i )
338  {
339  std::stringstream filenamei;
340  filenamei << filename_without_suffix << "." << i << suffix;
341 
342  MeshDbView* mesh_db_view_ptr = new MeshDbView ( tdim, gdim );
343  mesh_db_view_ptr->load ( filenamei.str ( ), comm );
344  mesh_db_view_ptr->set_db ( database );
345  history_meshes[i] = mesh_db_view_ptr;
346  }
347  refined_mesh_ptr->set_history ( history_meshes );
348 
349  mesh = refined_mesh_ptr;
350  }
351  else if ( impl == mesh::IMPL_DBVIEW )
352  {
353  MeshDatabasePtr database ( new MeshDatabase ( tdim, gdim ) );
354  database->load ( filename, comm );
355  MeshDbView* mesh_db_view_ptr = new MeshDbView ( tdim, gdim );
356  mesh_db_view_ptr->load ( filename, comm );
357  mesh_db_view_ptr->set_db ( database );
358  mesh = mesh_db_view_ptr;
359  }
360 
361  return mesh;
362 #else
363  throw "HiFlow was not compiled with HDF5 support!\n";
364 #endif
365  }
SharedPtr< MeshPXestDatabase >::Type MeshPXestDatabasePtr
MeshPtr compute_ghost_cells_pXest(const Mesh &local_mesh, const MPI_Comm &comm, int layer_width)
Create new mesh containing the ghost cells from neighboring sub-domains. Implementation for MeshP4est...
Definition: mesh_tools.cc:1436
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58
SharedPtr< MeshDatabase >::Type MeshDatabasePtr
Definition: mesh_database.h:37

◆ local_fixed_fraction_strategy()

void hiflow::local_fixed_fraction_strategy ( double  refine_frac,
double  coarsen_frac,
int  threshold,
int  coarsen_marker,
const std::vector< double > &  indicators,
std::vector< int > &  adapt_markers 
)

set of functions for building mesh adaption flags out of local error indicators

refine / coarsen a fixed fraction of cells on local processor

Parameters
[in]refine_fracrefine the refince_frac% cells with largest indicators
[in]coarsen_fraccoarsen the rcoarsen_frac% cells with smallest indicators
[in]thresholdstart coarsening when more than #threshold cells are present in mesh
[in]coarsen_markercoarsen family l of cells k if {k Family(l)} coarsen_marker(k) <= #Family(l)
[in]indicatorserror indicators
[out]adapt_markersresulting adaption markers to be passed to refine routine of mesh

Definition at line 26 of file refinement_strategies.cc.

References sortingPermutation().

32  {
33  adapt_markers.resize ( indicators.size ( ), 0 );
34  std::vector<int> sort_ind ( indicators.size ( ), 0 );
35 
36  for ( int i = 0; i < indicators.size ( ); ++i )
37  {
38  sort_ind[i] = i;
39  }
40  sortingPermutation ( indicators, sort_ind );
41 
42  // 1. Mark cells for refinement
43  int first_cell = std::floor ( ( 1. - refine_frac ) * sort_ind.size ( ) );
44  int num_global_cells = indicators.size ( );
45 
46  for ( int l = first_cell; l < sort_ind.size ( ); ++l )
47  {
48  int cell_index = sort_ind[l];
49  adapt_markers[cell_index] = 1;
50  }
51 
52  // 2.Mark cells for coarsening
53  if ( num_global_cells >= threshold )
54  {
55  int last_cell = std::ceil ( coarsen_frac * sort_ind.size ( ) );
56  for ( int l = 0; l < last_cell; ++l )
57  {
58  int cell_index = sort_ind[l];
59  adapt_markers[cell_index] = coarsen_marker;
60  }
61  }
62  }
void sortingPermutation(const std::vector< T > &values, std::vector< int > &v)
Function to get the corresponding permutation for sorting of values vector. Permutation vector is all...

◆ make_tensor_index() [1/7]

TensorIndex<0> hiflow::make_tensor_index ( )
inline

Definition at line 109 of file tensor.h.

110  {
111  int s[1] = { 1 };
112  return TensorIndex<0>( s );
113  }

◆ make_tensor_index() [2/7]

TensorIndex<1> hiflow::make_tensor_index ( int  dim1)
inline

Definition at line 116 of file tensor.h.

117  {
118  int s[2] = { dim1, 1 };
119  return TensorIndex<1>( s );
120  }

◆ make_tensor_index() [3/7]

TensorIndex<2> hiflow::make_tensor_index ( int  dim1,
int  dim2 
)
inline

Definition at line 123 of file tensor.h.

124  {
125  int s[3] = { dim1 * dim2, dim2, 1 };
126  return TensorIndex<2>( s );
127  }

◆ make_tensor_index() [4/7]

TensorIndex<3> hiflow::make_tensor_index ( int  dim1,
int  dim2,
int  dim3 
)
inline

Definition at line 130 of file tensor.h.

131  {
132  int s[4] = { dim1 * dim2 * dim3, dim2 * dim3, dim3, 1 };
133  return TensorIndex<3>( s );
134  }

◆ make_tensor_index() [5/7]

TensorIndex<4> hiflow::make_tensor_index ( int  dim1,
int  dim2,
int  dim3,
int  dim4 
)
inline

Definition at line 137 of file tensor.h.

138  {
139  int s[5] = { dim1 * dim2 * dim3 * dim4, dim2 * dim3 * dim4, dim3 * dim4, dim4, 1 };
140  return TensorIndex<4>( s );
141  }

◆ make_tensor_index() [6/7]

TensorIndex<5> hiflow::make_tensor_index ( int  dim1,
int  dim2,
int  dim3,
int  dim4,
int  dim5 
)
inline

Definition at line 144 of file tensor.h.

145  {
146  int s[6] = { dim1 * dim2 * dim3 * dim4 * dim5, dim2 * dim3 * dim4 * dim5, dim3 * dim4 * dim5, dim4 * dim5, dim5, 1 };
147  return TensorIndex<5>( s );
148  }

◆ make_tensor_index() [7/7]

TensorIndex<6> hiflow::make_tensor_index ( int  dim1,
int  dim2,
int  dim3,
int  dim4,
int  dim5,
int  dim6 
)
inline

Definition at line 151 of file tensor.h.

152  {
153  int s[7] = { dim1 * dim2 * dim3 * dim4 * dim5 * dim6,
154  dim2 * dim3 * dim4 * dim5 * dim6,
155  dim3 * dim4 * dim5 * dim6,
156  dim4 * dim5 * dim6,
157  dim5 * dim6,
158  dim6,
159  1 };
160  return TensorIndex<6>( s );
161  }

◆ matrix_minor()

template<class DataType >
Mat<3, 3, DataType>::value_type hiflow::matrix_minor ( const Mat< 3, 3, DataType > &  m,
size_t  i,
size_t  j 
)
inline

Definition at line 647 of file vector_algebra.h.

648  {
649  const int indI0 = ( i + 1 ) % 3;
650  const int indI1 = ( i + 2 ) % 3;
651  const int indJ0 = ( j + 1 ) % 3;
652  const int indJ1 = ( j + 2 ) % 3;
653  return m ( indI0, indJ0 ) * m ( indI1, indJ1 ) - m ( indI0, indJ1 ) * m ( indI1, indJ0 );
654  }

◆ MatrixMatrixMult()

template<size_t M, size_t N, size_t P, class DataType >
void hiflow::MatrixMatrixMult ( Mat< M, P, DataType > &  out,
const Mat< M, N, DataType > &  mat1,
const Mat< N, P, DataType > &  mat2 
)
inline

Definition at line 525 of file vector_algebra.h.

Referenced by hiflow::EvalRightMatrixMult< M, N, P, DataType >::operator()(), and hiflow::EvalSurfaceElement< DIM, DataType >::operator()().

526  {
527  for ( size_t i = 0; i < M; ++i )
528  { // loop over rows
529  for ( size_t k = 0; k < N; ++k )
530  { // inner loop
531 # pragma clang loop vectorize(enable)
532  for ( size_t j = 0; j < P; ++j )
533  { // loop over columns
534  out ( i, j ) += mat1 ( i, k ) * mat2 ( k, j );
535  }
536  }
537  }
538  }

◆ norm()

template<size_t N, class DataType >
Vec<N, DataType>::value_type hiflow::norm ( const Vec< N, DataType > &  v1)
inline

Computes the Euclidean norm of a vector.

Definition at line 277 of file vector_algebra.h.

References dot().

Referenced by hiflow::doffem::CellTransformation< DataType >::inverse_newton_2d(), hiflow::doffem::CellTransformation< DataType >::inverse_newton_3d(), hiflow::doffem::FEType< LAD_high ::DataType >::is_point_on_subentity(), CPUsimple_lVector< ValueType >::Norm2(), CPUopenmp_lVector< ValueType >::Norm2(), normal(), hiflow::la::GMRESFunctor< ValueType, Timer >::operator()(), hiflow::la::CGFunctor< ValueType, Timer >::operator()(), and hiflow::EvalMappedNormal< DIM, DataType >::operator()().

278  {
279  typename Vec<N, DataType>::value_type res = typename Vec<N, DataType>::value_type ( );
280  res = std::sqrt ( dot ( v1, v1 ) );
281  return res;
282  }
Vec< N, DataType >::value_type dot(const Vec< N, DataType > &v1, const Vec< N, DataType > &v2)
Computes the scalar product of two vectors.

◆ normal() [1/3]

template<class DataType >
Vec<2, DataType> hiflow::normal ( const Vec< 2, DataType > &  v)
inline

Computes the normed normal of a 2d vector.

Definition at line 287 of file vector_algebra.h.

References norm().

Referenced by hiflow::doffem::FEType< LAD_high ::DataType >::is_point_on_subentity().

288  {
289  Vec<2, DataType> v2;
290  v2[0] = -v[1];
291  v2[1] = v[0];
292  DataType v2norm = norm ( v2 );
293  v2 /= v2norm;
294  return v2;
295  }
Vec< N, DataType >::value_type norm(const Vec< N, DataType > &v1)
Computes the Euclidean norm of a vector.

◆ normal() [2/3]

template<class DataType >
Vec<3, DataType> hiflow::normal ( const Vec< 3, DataType > &  v1,
const Vec< 3, DataType > &  v2 
)
inline

Computes the normed normal of two 3d vectors.

Definition at line 300 of file vector_algebra.h.

References cross(), and norm().

301  {
302  Vec<3, DataType> v3 = cross ( v1, v2 );
303  DataType v3norm = norm ( v3 );
304  v3 /= v3norm;
305  return v3;
306  }
Vec< 3, DataType > cross(const Vec< 3, DataType > &v1, const Vec< 3, DataType > &v2)
Computes the cross product of two 3d vectors.
Vec< N, DataType >::value_type norm(const Vec< N, DataType > &v1)
Computes the Euclidean norm of a vector.

◆ normal() [3/3]

template<class DataType >
Vec<3, DataType> hiflow::normal ( const Vec< 6, DataType > &  v1v2)
inline

Computes the normed normal of two 3d vectors.

Definition at line 311 of file vector_algebra.h.

References cross(), and norm().

312  {
313  DataType v1_array[3] = { v1v2[0], v1v2[1], v1v2[2] };
314  DataType v2_array[3] = { v1v2[3], v1v2[4], v1v2[5] };
315  Vec<3, DataType> v1 ( v1_array );
316  Vec<3, DataType> v2 ( v2_array );
317  Vec<3, DataType> v3 = cross ( v1, v2 );
318  DataType v3norm = norm ( v3 );
319  v3 /= v3norm;
320  return v3;
321  }
Vec< 3, DataType > cross(const Vec< 3, DataType > &v1, const Vec< 3, DataType > &v2)
Computes the cross product of two 3d vectors.
Vec< N, DataType >::value_type norm(const Vec< N, DataType > &v1)
Computes the Euclidean norm of a vector.

◆ operator*() [1/8]

template<size_t N, class DataType >
Vec<N, DataType> hiflow::operator* ( const Vec< N, DataType > &  v,
const typename Vec< N, DataType >::value_type  s 
)
inline

Definition at line 206 of file vector_algebra.h.

207  {
208  Vec<N, DataType> tmp ( v );
209  tmp *= s;
210  return tmp;
211  }

◆ operator*() [2/8]

template<size_t N, class DataType >
Vec<N, DataType> hiflow::operator* ( const typename Vec< N, DataType >::value_type  s,
const Vec< N, DataType > &  v 
)
inline

Definition at line 214 of file vector_algebra.h.

215  {
216  return v * s;
217  }

◆ operator*() [3/8]

template<size_t M, size_t N, class DataType >
Mat<M, N, DataType> hiflow::operator* ( const Mat< M, N, DataType > &  m,
const typename Mat< M, N, DataType >::value_type  s 
)
inline

Definition at line 543 of file vector_algebra.h.

544  {
545  Mat<M, N, DataType> tmp ( m );
546  tmp *= s;
547  return tmp;
548  }

◆ operator*() [4/8]

template<size_t M, size_t N, class DataType >
Mat<M, N, DataType> hiflow::operator* ( const typename Mat< M, N, DataType >::value_type  s,
const Mat< M, N, DataType > &  m 
)
inline

Definition at line 551 of file vector_algebra.h.

552  {
553  Mat<M, N, DataType> tmp ( m );
554  tmp *= s;
555  return tmp;
556  }

◆ operator*() [5/8]

template<size_t M, size_t N, class DataType >
Mat<M, N, DataType> hiflow::operator* ( const Mat< M, N, DataType > &  m1,
const Mat< N, N, DataType > &  m2 
)
inline

Definition at line 585 of file vector_algebra.h.

586  {
587  Mat<M, N, DataType> tmp ( m1 );
588  tmp *= m2;
589  return tmp;
590  }

◆ operator*() [6/8]

template<size_t M, size_t N, size_t P, class DataType >
Mat<M, P, DataType> hiflow::operator* ( const Mat< M, N, DataType > &  A,
const Mat< N, P, DataType > &  B 
)
inline

Definition at line 595 of file vector_algebra.h.

596  {
597  Mat<M, P, DataType> C;
598  for ( size_t i = 0; i < M; ++i )
599  {
600  for ( size_t j = 0; j < N; ++j )
601  {
602  for ( size_t k = 0; k < P; ++k )
603  {
604  C ( i, k ) += A ( i, j ) * B ( j, k );
605  }
606  }
607  }
608  return C;
609  }

◆ operator*() [7/8]

template<size_t M, size_t N, class DataType >
Vec<M, DataType> hiflow::operator* ( const Mat< M, N, DataType > &  m,
const Vec< N, DataType > &  v 
)
inline

Definition at line 614 of file vector_algebra.h.

615  {
616  Vec<M, DataType> mv;
617  for ( size_t i = 0; i < M; ++i )
618  {
619  for ( size_t j = 0; j < N; ++j )
620  {
621  mv[i] += m ( i, j ) * v[j];
622  }
623  }
624  return mv;
625  }

◆ operator*() [8/8]

template<size_t M, size_t N, class DataType >
Vec<N, DataType> hiflow::operator* ( const Vec< M, DataType > &  v,
const Mat< M, N, DataType > &  m 
)
inline

Definition at line 630 of file vector_algebra.h.

631  {
632  Vec<N, DataType> mv;
633  for ( size_t i = 0; i < M; ++i )
634  {
635 # pragma clang loop vectorize(enable)
636  for ( size_t j = 0; j < N; ++j )
637  {
638  mv[j] += m ( i, j ) * v[i];
639  }
640  }
641  return mv;
642  }

◆ operator+() [1/2]

template<size_t N, class DataType >
Vec<N, DataType> hiflow::operator+ ( const Vec< N, DataType > &  v1,
const Vec< N, DataType > &  v2 
)
inline

Definition at line 220 of file vector_algebra.h.

221  {
222  Vec<N, DataType> tmp ( v1 );
223  tmp += v2;
224  return tmp;
225  }

◆ operator+() [2/2]

template<size_t M, size_t N, class DataType >
Mat<M, N, DataType> hiflow::operator+ ( const Mat< M, N, DataType > &  m1,
const Mat< M, N, DataType > &  m2 
)
inline

Definition at line 567 of file vector_algebra.h.

568  {
569  Mat<M, N, DataType> tmp ( m1 );
570  tmp += m2;
571  return tmp;
572  }

◆ operator-() [1/2]

template<size_t N, class DataType >
Vec<N, DataType> hiflow::operator- ( const Vec< N, DataType > &  v1,
const Vec< N, DataType > &  v2 
)
inline

Definition at line 228 of file vector_algebra.h.

229  {
230  Vec<N, DataType> tmp ( v1 );
231  tmp -= v2;
232  return tmp;
233  }

◆ operator-() [2/2]

template<size_t M, size_t N, class DataType >
Mat<M, N, DataType> hiflow::operator- ( const Mat< M, N, DataType > &  m1,
const Mat< M, N, DataType > &  m2 
)
inline

Definition at line 575 of file vector_algebra.h.

576  {
577  Mat<M, N, DataType> tmp ( m1 );
578  tmp -= m2;
579  return tmp;
580  }

◆ operator/()

template<size_t M, size_t N, class DataType >
Mat<M, N, DataType> hiflow::operator/ ( const Mat< M, N, DataType > &  m,
typename Mat< M, N, DataType >::value_type  s 
)
inline

Definition at line 559 of file vector_algebra.h.

560  {
561  Mat<M, N, DataType> tmp ( m );
562  tmp /= s;
563  return tmp;
564  }

◆ operator<<() [1/5]

std::ostream & hiflow::operator<< ( std::ostream &  os,
const Timer timer 
)

Output operator.

Definition at line 22 of file timer.cc.

References hiflow::Timer::get_duration().

23  {
24  os << timer.get_duration ( ) << " s";
25  return os;
26  }

◆ operator<<() [2/5]

template<class DataType >
std::ostream& hiflow::operator<< ( std::ostream &  s,
const PeriodicBoundaryConditions< DataType > &  cond 
)

Definition at line 279 of file periodic_boundary_conditions.cc.

280  {
281  s << "PeriodicBoundaryConditions" << std::endl;
282  s << " Corresponding Boundaries:" << std::endl;
284  it2 = cond.boundary_descriptor_.begin ( );
285  while ( it2 != cond.boundary_descriptor_.end ( ) )
286  {
287  s << " " << it2->first << " <-> " << it2->second << std::endl;
288  ++it2;
289  }
290  s << " Boundary DoFs on (mat, var):" << std::endl;
291  typename std::map < std::pair<typename PeriodicBoundaryConditions<DataType>::MaterialNumber, int>, std::vector<doffem::DofID> >::const_iterator it = cond.dof_id_map_.begin ( );
292  while ( it != cond.dof_id_map_.end ( ) )
293  {
294  s << " (" << it->first.first << ", " << it->first.second << "): " << it->second.size ( ) << std::endl;
295  ++it;
296  }
297  s << " # corresponding DoFs: " << cond.corresponding_dof_.size ( ) << std::endl;
298 
299  return s;
300  }
int MaterialNumber
Type for the material number.
Definition: types.h:86

◆ operator<<() [3/5]

template<size_t N, class DataType >
std::ostream& hiflow::operator<< ( std::ostream &  os,
const Vec< N, DataType > &  v 
)

Output operator for vectors.

Definition at line 326 of file vector_algebra.h.

327  {
328  os << "[ ";
329  for ( size_t i = 0; i < N; ++i )
330  {
331  os << v[i] << " ";
332  }
333  os << "]";
334  return os;
335  }

◆ operator<<() [4/5]

std::ostream& hiflow::operator<< ( std::ostream &  os,
const PropertyTree tree 
)

Definition at line 339 of file property_tree.cc.

References pretty_print::end(), and hiflow::PropertyTree::getName().

340  {
341  std::stack< std::pair<std::string, const PropertyTree* > > s;
342  s.push ( std::make_pair ( tree.getName ( ), &tree ) );
343 
344  while ( !s.empty ( ) )
345  {
346  const std::pair<std::string, const PropertyTree*> node = s.top ( );
347  s.pop ( );
348 
349  if ( !node.second->text.empty ( ) )
350  os << node.first << " -> " << node.second->get<std::string>( ) << "\n";
351  else
352  os << node.first << "\n";
353  for ( PropertyTree::const_iterator it = node.second->begin_children ( ), end = node.second->end_children ( ); it != end; ++it )
354  {
355  s.push ( std::make_pair ( node.first + std::string ( "->" ) + it->second->getName ( ), it->second ) );
356  }
357 
358  }
359  return os;
360  }
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)

◆ operator<<() [5/5]

template<size_t M, size_t N, class DataType >
std::ostream& hiflow::operator<< ( std::ostream &  os,
const Mat< M, N, DataType > &  m 
)

Output operator for a general matrix.

Definition at line 900 of file vector_algebra.h.

901  {
902  os << "[";
903  for ( size_t i = 0; i < M; ++i )
904  {
905  for ( size_t j = 0; j < N; ++j )
906  {
907  os << " " << m ( i, j );
908  }
909  if ( i < M - 1 )
910  {
911  os << ";";
912  }
913  }
914  os << " ]";
915  return os;
916  }

◆ partition_and_distribute() [1/3]

mesh::MeshPtr hiflow::partition_and_distribute ( const MeshPtr  master_mesh,
const int  master_rank,
const MPI_Comm &  comm,
int uniform_ref_steps,
IMPL  impl 
)

Partition and distribute mesh from one process to all processes. Uses a.

Partition and distribute mesh that has been read on the master process to all processes in the given MPI communicator. Uses a MetisGraphPartitioner if available, otherwise a NaiveGraphPartitioner. The function returns the part of the mesh belonging to the local process.

Parameters
master_meshMeshPtr to the mesh to be distributed on master process, 0 on other processes.
master_rankRank of master process.
commMPI communicator used for communication.
Returns
Shared pointer to local part of the distributed mesh.

MetisGraphPartitioner if available, otherwise a NaiveGraphPartitioner.

Definition at line 600 of file mesh_tools.cc.

References hiflow::mesh::IMPL_DBVIEW, hiflow::mesh::IMPL_P4EST, LOG_ERROR, partition_and_distribute_dbview(), and partition_and_distribute_pXest().

Referenced by hiflow::la::gmg::BasicHierarchy< ConnectedLevelType >::init().

605  {
606  assert ( impl == IMPL_DBVIEW || impl == IMPL_P4EST );
607 
608  if ( impl == IMPL_P4EST )
609  {
610 #ifdef WITH_P4EST
611  assert ( uniform_ref_steps != NULL );
612  return partition_and_distribute_pXest ( master_mesh, master_rank, comm, *uniform_ref_steps );
613 #else
614  LOG_ERROR ( "Not compiled with p4ests support!" );
615  exit ( -1 );
616 #endif
617  }
618 
619 #ifdef WITH_PARMETIS
620  ParMetisGraphPartitioner gpartitioner;
621 #else
622 # ifdef WITH_METIS
623  MetisGraphPartitioner gpartitioner;
624 # else
625  NaiveGraphPartitioner gpartitioner;
626 # endif
627 #endif
628 
629  if ( uniform_ref_steps != NULL )
630  {
631  *uniform_ref_steps = 0;
632  }
633  return partition_and_distribute_dbview ( master_mesh,
634 
635  master_rank,
636  comm,
637  &gpartitioner );
638 
639  }
#define LOG_ERROR(stream)
Log an error message to the log "error".
Definition: log.h:233
MeshPtr partition_and_distribute_dbview(const MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, const MeshPartitioner *mpartitioner)
Partition and distribute mesh from one process to all processes using.
Definition: mesh_tools.cc:991
MeshPtr partition_and_distribute_pXest(const MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, int &uniform_ref_steps)
Partition and distribute coarse mesh. Initially, all processes contain the coarse mesh and the p4est ...
Definition: mesh_tools.cc:1059

◆ partition_and_distribute() [2/3]

mesh::MeshPtr hiflow::partition_and_distribute ( const mesh::MeshPtr  master_mesh,
const int  master_rank,
const MPI_Comm &  comm,
const mesh::GraphPartitioner gpartitioner,
int uniform_ref_steps = NULL,
mesh::IMPL  impl = mesh::IMPL_DBVIEW 
)

Partition and distribute mesh from one process to all processes using.

a graph partitioner acting on the dual graph of the mesh.

Definition at line 641 of file mesh_tools.cc.

References hiflow::mesh::IMPL_DBVIEW, and partition_and_distribute_dbview().

647  {
648  assert ( impl == IMPL_DBVIEW );
649  if ( impl == IMPL_DBVIEW )
650  {
651  if ( uniform_ref_steps != NULL )
652  {
653  *uniform_ref_steps = 0;
654  }
655  return partition_and_distribute_dbview ( master_mesh,
656  master_rank,
657  comm,
658  gpartitioner );
659  }
660  }
MeshPtr partition_and_distribute_dbview(const MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, const MeshPartitioner *mpartitioner)
Partition and distribute mesh from one process to all processes using.
Definition: mesh_tools.cc:991

◆ partition_and_distribute() [3/3]

mesh::MeshPtr hiflow::partition_and_distribute ( const mesh::MeshPtr  master_mesh,
const int  master_rank,
const MPI_Comm &  comm,
const mesh::MeshPartitioner mpartitioner,
int uniform_ref_steps = NULL,
mesh::IMPL  impl = mesh::IMPL_DBVIEW 
)

Partition and distribute mesh from one process to all processes using.

a mesh partitioner.

Definition at line 662 of file mesh_tools.cc.

References hiflow::mesh::IMPL_DBVIEW, and partition_and_distribute_dbview().

668  {
669  assert ( impl == IMPL_DBVIEW );
670  if ( impl == IMPL_DBVIEW )
671  {
672  if ( uniform_ref_steps != NULL )
673  {
674  *uniform_ref_steps = 0;
675  }
676  return partition_and_distribute_dbview ( master_mesh,
677  master_rank,
678  comm,
679  mpartitioner );
680  }
681  }
MeshPtr partition_and_distribute_dbview(const MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, const MeshPartitioner *mpartitioner)
Partition and distribute mesh from one process to all processes using.
Definition: mesh_tools.cc:991

◆ partition_and_distribute_dbview() [1/2]

mesh::MeshPtr hiflow::partition_and_distribute_dbview ( const MeshPtr  master_mesh,
const int  master_rank,
const MPI_Comm &  comm,
const GraphPartitioner gpartitioner 
)

Partition and distribute mesh from one process to all processes using.

MeshDbView Implementation /////////////////////

Partition and distribute mesh that has been read on the master process to all processes in the given MPI communicator using a given graph partitioner. The function returns the part of the mesh belonging to the local process.

Parameters
master_meshMesh to be distributed on master process, 0 on other processes.
master_rankRank of master process.
commMPI communicator used for communication.
gpartitionerThe graph partitioner to be employed, e.g. NaiveGraphPartitioner, MetisGraphPartitioner or ParMetisGraphPartitioner if available.
Returns
Shared pointer to local part of the distributed mesh.

MeshDbView Implementation ///////////// a graph partitioner acting on the dual graph of the mesh.

Definition at line 943 of file mesh_tools.cc.

References hiflow::mesh::Graph::clear(), hiflow::mesh::compute_dual_graph(), create_distributed_mesh(), hiflow::mesh::IMPL_DBVIEW, hiflow::mesh::GraphPartitioner::is_collective(), and hiflow::mesh::GraphPartitioner::partition_graph().

Referenced by partition_and_distribute().

947  {
948  assert ( gpartitioner != 0 );
949 
950  int my_rank = -1, num_ranks = -2;
951  MPI_Comm_rank ( comm, &my_rank );
952  MPI_Comm_size ( comm, &num_ranks );
953  assert ( 0 <= my_rank );
954  assert ( 0 <= master_rank );
955  assert ( master_rank < num_ranks );
956  assert ( my_rank < num_ranks );
957 
958  // check that master_mesh is non-null iff we are on master process
959  assert ( my_rank != master_rank || master_mesh != 0 );
960  assert ( my_rank == master_rank || master_mesh == 0 );
961 
962  Graph mesh_graph;
963  mesh_graph.clear ( );
964 
965  // only master proc computes the graph
966  if ( my_rank == master_rank )
967  {
968  compute_dual_graph ( *master_mesh, &mesh_graph );
969  }
970 
971  std::vector<int> partitioning;
972  if ( ( gpartitioner->is_collective ( ) ) || ( my_rank == master_rank ) )
973  {
974  gpartitioner->partition_graph ( mesh_graph, master_rank, 0, 0, comm, &partitioning );
975  }
976 
977  return create_distributed_mesh ( master_mesh, master_rank, comm, partitioning, IMPL_DBVIEW );
978  }
void compute_dual_graph(const Mesh &mesh, Graph *graph)
Compute the dual graph of a mesh.
Definition: partitioning.cc:66
mesh::MeshPtr create_distributed_mesh(const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, std::vector< int > &partitioning, mesh::IMPL impl)
creates a distributed mesh from sequential master_mesh for a given partitioning
Definition: mesh_tools.cc:368

◆ partition_and_distribute_dbview() [2/2]

mesh::MeshPtr hiflow::partition_and_distribute_dbview ( const MeshPtr  master_mesh,
const int  master_rank,
const MPI_Comm &  comm,
const MeshPartitioner mpartitioner 
)

Partition and distribute mesh from one process to all processes using.

Partition and distribute mesh that has been read on the master process to all processes in the given MPI communicator, using a given mesh partitioner. The function returns the part of the mesh belonging to the local process.

Parameters
master_meshMesh to be distributed on master process, 0 on other processes.
master_rankRank of master process.
commMPI communicator used for communication.
mpartitionerThe mesh partitioner to be employed.
Returns
Shared pointer to local part of mesh

a mesh partitioner.

Definition at line 991 of file mesh_tools.cc.

References create_distributed_mesh(), hiflow::mesh::IMPL_DBVIEW, LOG_DEBUG, hiflow::mesh::MeshPartitioner::partition_mesh(), and quit_program.

995  {
996  LOG_DEBUG ( 1, "Not yet implemented." );
997  quit_program ( );
998 
999  assert ( mpartitioner != 0 );
1000 
1001  int my_rank = -1, num_ranks = -2;
1002  MPI_Comm_rank ( comm, &my_rank );
1003  MPI_Comm_size ( comm, &num_ranks );
1004  assert ( 0 <= my_rank );
1005  assert ( 0 <= master_rank );
1006  assert ( master_rank < num_ranks );
1007  assert ( my_rank < num_ranks );
1008 
1009  // check that master_mesh is non-null iff we are on master process
1010  assert ( my_rank != master_rank || master_mesh != 0 );
1011  assert ( my_rank == master_rank || master_mesh == 0 );
1012 
1013  std::vector<int> partitioning;
1014 
1015  if ( mpartitioner == 0 )
1016  {
1017  LOG_DEBUG ( 1, "Error: User must provide a mesh partitioner!" );
1018  quit_program ( );
1019  }
1020 
1021  mpartitioner->partition_mesh ( master_mesh, master_rank, /*num_ranks,*/ 0, 0, comm, &partitioning );
1022  return create_distributed_mesh ( master_mesh, master_rank, comm, partitioning, mesh::IMPL_DBVIEW );
1023  }
#define LOG_DEBUG(lvl, stream)
Definition: log.h:221
#define quit_program()
Definition: macros.h:53
mesh::MeshPtr create_distributed_mesh(const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, std::vector< int > &partitioning, mesh::IMPL impl)
creates a distributed mesh from sequential master_mesh for a given partitioning
Definition: mesh_tools.cc:368

◆ partition_and_distribute_pXest()

mesh::MeshPtr hiflow::partition_and_distribute_pXest ( const mesh::MeshPtr  master_mesh,
const int  master_rank,
const MPI_Comm &  comm,
int uniform_ref_steps 
)

Partition and distribute coarse mesh. Initially, all processes contain the coarse mesh and the p4est structures p4est_t and p4est_connectivity_t. Note that p4est uses its own partitioner based on z-curves.

MeshP4est Implementation //////////////

Definition at line 1059 of file mesh_tools.cc.

References hiflow::mesh::Graph::clear(), hiflow::mesh::compute_dual_graph(), create_distributed_mesh(), extract_local_mesh(), hiflow::mesh::MeshPXest::get_db(), hiflow::mesh::QuadData::get_owner_rank(), hiflow::mesh::QuadData::get_tree_id(), hiflow::mesh::IMPL_P4EST, LOG_DEBUG, hiflow::mesh::NaiveGraphPartitioner::partition_graph(), hiflow::mesh::QuadData_size(), hiflow::mesh::QuadData::set_cell_id(), hiflow::mesh::QuadData::set_remote_cell_id(), string_from_range(), and vec2ptr().

Referenced by partition_and_distribute().

1063  {
1064 #ifdef WITH_P4EST
1065  // *********************************************************************
1066  // 0. check some stuff
1067  int my_rank = -1, num_ranks = -2;
1068  MPI_Comm_rank ( comm, &my_rank );
1069  MPI_Comm_size ( comm, &num_ranks );
1070  assert ( 0 <= my_rank );
1071  assert ( 0 <= master_rank );
1072  assert ( master_rank < num_ranks );
1073  assert ( my_rank < num_ranks );
1074 
1075  // check that master_mesh is non-null iff we are on master process
1076  //assert ( my_rank != master_rank || master_mesh != 0 );
1077  //assert ( my_rank == master_rank || master_mesh == 0 );
1078 
1079  // cast pointer
1080  boost::intrusive_ptr<MeshPXest> master_mesh_pXest = boost::static_pointer_cast<MeshPXest> ( master_mesh );
1081 
1082  // *********************************************************************
1083  // 0. check if all processes have read in the mesh
1084  int has_mesh = 0;
1085  int seq_rank = master_rank;
1086  bool parallel = false;
1087  if ( master_mesh != 0 )
1088  {
1089  has_mesh = 1;
1090  }
1091  int num_mesh = 0;
1092  MPI_Allreduce ( &has_mesh, &num_mesh, 1, MPI_INT, MPI_SUM, comm );
1093  if ( num_mesh == num_ranks )
1094  {
1095  // everyone has the coarse mesh available
1096  seq_rank = my_rank;
1097  parallel = true;
1098  }
1099  else
1100  {
1101  seq_rank = master_rank;
1102  parallel = false;
1103  }
1104 
1105  // *********************************************************************
1106  // 1. Create p4est forest structure -> yields initial partitioning
1107 
1108  // broadcast p4est connectivity data
1109  int num_conn_vertices;
1110  int num_conn_cells;
1111  int array1_size;
1112  int array2_size;
1113  std::vector<int> tree_to_vertices;
1114  std::vector<double> conn_vertices;
1115  int tdim;
1116 
1117  std::vector<int> broadcast_info ( 7, 0 );
1118 
1119  uniform_ref_steps = 0;
1120  MeshPtr ref_master_mesh;
1121  std::vector<int> graph_part;
1122  int part_size = 0;
1123 
1124  // If more processes than coarse cells are involved -> refine mesh uniformly until every process can have at least one cell
1125  if ( my_rank == seq_rank )
1126  {
1127  tdim = master_mesh->tdim ( );
1128  num_conn_cells = master_mesh_pXest->get_db ( )->get_num_conn_cells ( );
1129  LOG_DEBUG ( 1, "Number of coarse cells " << num_conn_cells );
1130 
1131  ref_master_mesh = master_mesh;
1132 
1133  while ( num_conn_cells < 8 * num_ranks )
1134  {
1135  /*int num_ref_steps = (int) std::ceil( 8 * std::log((double) num_ranks / (double) num_conn_cells)
1136  / std::log( static_cast<int>(std::pow(static_cast<double>(2), tdim)) ) ); */
1137 
1138  ref_master_mesh = ref_master_mesh->refine_uniform_seq ( 1 );
1139  master_mesh_pXest = boost::static_pointer_cast<MeshPXest> ( ref_master_mesh );
1140  num_conn_cells = master_mesh_pXest->get_db ( )->get_num_conn_cells ( );
1141  LOG_DEBUG ( 1, "Number of coarse cells " << num_conn_cells );
1142  uniform_ref_steps++;
1143  }
1144 
1145  LOG_DEBUG ( 1, "Initial mesh was uniformly refined " << uniform_ref_steps << " times " );
1146 
1147  // use graph partitioner to optimize communication pattern of mesh -> obtain graph_part
1148  // this partitioning is used to partition the newly created forest
1149  Graph mesh_graph;
1150  mesh_graph.clear ( );
1151 
1152 # ifdef WITH_METIS
1153  MetisGraphPartitioner gpartitioner;
1154 # else
1155  NaiveGraphPartitioner gpartitioner;
1156 # endif
1157  compute_dual_graph ( *ref_master_mesh, &mesh_graph );
1158  gpartitioner.partition_graph ( mesh_graph, master_rank, 0, 0, comm, &graph_part );
1159  part_size = graph_part.size ( );
1160 
1161  // collect data for broadcasting
1162  num_conn_vertices = master_mesh_pXest->get_db ( )->get_num_conn_vertices ( );
1163  num_conn_cells = master_mesh_pXest->get_db ( )->get_num_conn_cells ( );
1164 
1165  // PERF_TODO: evtl copy vermeiden
1166  tree_to_vertices = *master_mesh_pXest->get_db ( )->get_tree_to_vertices ( );
1167  conn_vertices = *master_mesh_pXest->get_db ( )->get_conn_vertices ( );
1168  array1_size = tree_to_vertices.size ( );
1169  array2_size = conn_vertices.size ( );
1170 
1171  broadcast_info[0] = tdim;
1172  broadcast_info[1] = num_conn_cells;
1173  broadcast_info[2] = num_conn_vertices;
1174  broadcast_info[3] = array1_size;
1175  broadcast_info[4] = array2_size;
1176  broadcast_info[5] = uniform_ref_steps;
1177  broadcast_info[6] = part_size;
1178  }
1179 
1180  if ( !parallel )
1181  {
1182  // broadcast connectivity from master
1183  MPI_Bcast ( vec2ptr ( broadcast_info ), 7, MPI_INT, master_rank, comm );
1184 
1185  tdim = broadcast_info[0];
1186  num_conn_cells = broadcast_info[1];
1187  num_conn_vertices = broadcast_info[2];
1188  array1_size = broadcast_info[3];
1189  array2_size = broadcast_info[4];
1190  uniform_ref_steps = broadcast_info[5];
1191  part_size = broadcast_info[6];
1192 
1193  if ( my_rank != seq_rank )
1194  {
1195  tree_to_vertices.resize ( array1_size );
1196  conn_vertices.resize ( array2_size );
1197  graph_part.resize ( part_size );
1198  }
1199  MPI_Bcast ( vec2ptr ( tree_to_vertices ), array1_size, MPI_INT, master_rank, comm );
1200  MPI_Bcast ( vec2ptr ( conn_vertices ), array2_size, MPI_DOUBLE, master_rank, comm );
1201  MPI_Bcast ( &graph_part[0], part_size, MPI_INT, master_rank, comm );
1202  }
1203  // compute number of cells per processor, used by forest partitioner
1204  std::vector<int> cells_per_proc ( num_ranks, 0 );
1205  for ( int l = 0; l < graph_part.size ( ); ++l )
1206  {
1207  cells_per_proc[ graph_part[l] ]++;
1208  }
1209 
1210  for ( int l = 0; l < cells_per_proc.size ( ); ++l )
1211  {
1212  LOG_DEBUG ( 2, "part: " << string_from_range ( graph_part.begin ( ), graph_part.end ( ) ) );
1213  assert ( cells_per_proc[l] > 0 );
1214  }
1215 
1216  // build connectivity and forest on each process, get initial partition from forest
1217  p4est_connectivity_t* conn4;
1218  p4est_t* forest4;
1219 
1220  p8est_connectivity_t* conn8;
1221  p8est_t* forest8;
1222 
1223  std::vector<int> partitioning;
1224  treeId first_local_tree = -1;
1225  treeId last_local_tree = -2;
1226 
1227  ForestInitData init_data ( my_rank );
1228 
1229  std::vector<size_t> old_to_new_tree;
1230  if ( tdim == 2 )
1231  {
1232  // build connectivity
1233  LOG_DEBUG ( 1, "Build p4est conenctivity" );
1234  pXest_build_conn ( num_conn_vertices, num_conn_cells, conn_vertices, tree_to_vertices, conn4 );
1235 
1236  // reorder connectivity according to graph_part
1237  LOG_DEBUG ( 1, "Reorder p4est conenctivity" );
1238  pXest_reorder_conn ( graph_part, conn4, old_to_new_tree );
1239 
1240  // reorder entity to quad mapping
1241  if ( my_rank == seq_rank )
1242  {
1243  master_mesh_pXest->get_db ( )->permute_entity_to_quad_map ( old_to_new_tree, 2, 0 );
1244  }
1245 
1246  // build forest
1247  LOG_DEBUG ( 1, "Build p4est forest" );
1248  forest4 = p4est_new ( comm, conn4, QuadData_size ( tdim ), pXest_init_fn, &init_data );
1249 
1250  // partition forest according to graph_part
1251  LOG_DEBUG ( 1, "Partition p4est forest" );
1252  pXest_partition_forest ( forest4, 0, cells_per_proc );
1253  //p4est_partition_ext ( forest4, 1, NULL );
1254 
1255  // sort quadrant arrays in forest
1256  LOG_DEBUG ( 1, "Sort quad arrays in forest" );
1257  pXest_sort_quad_arrays_in_forest ( forest4 );
1258 
1259  // get partitioning of trees. CAUTION: tree_id != cell_index
1260  partitioning = pXest_get_partition_from_initial_forest ( forest4 );
1261  first_local_tree = pXest_get_first_local_treeId ( forest4 );
1262  last_local_tree = pXest_get_last_local_treeId ( forest4 );
1263  }
1264  if ( tdim == 3 )
1265  {
1266  // build connectivity
1267  LOG_DEBUG ( 1, "Build p4est conenctivity" );
1268  pXest_build_conn ( num_conn_vertices, num_conn_cells, conn_vertices, tree_to_vertices, conn8 );
1269 
1270  // reorder connectivity according to graph_part
1271  LOG_DEBUG ( 1, "Reorder p4est conenctivity" );
1272  pXest_reorder_conn ( graph_part, conn8, old_to_new_tree );
1273 
1274  // reorder entity to quad mapping
1275  if ( my_rank == seq_rank )
1276  {
1277  master_mesh_pXest->get_db ( )->permute_entity_to_quad_map ( old_to_new_tree, 3, 0 );
1278  }
1279 
1280  // build forest
1281  LOG_DEBUG ( 1, "Build p4est forest" );
1282  forest8 = p8est_new ( comm, conn8, QuadData_size ( tdim ), pXest_init_fn, &init_data );
1283 
1284  // partition forest according to graph_part
1285  LOG_DEBUG ( 1, "Partition p4est forest" );
1286  pXest_partition_forest ( forest8, 0, cells_per_proc );
1287  //p8est_partition_ext ( forest8, 1, NULL );
1288 
1289  // sort quadrant arrays in forest
1290  LOG_DEBUG ( 1, "Sort quad arrays in forest" );
1291  pXest_sort_quad_arrays_in_forest ( forest8 );
1292 
1293  // get partitioning of trees. CAUTION: tree_id != cell_index
1294  partitioning = pXest_get_partition_from_initial_forest ( forest8 );
1295  first_local_tree = pXest_get_first_local_treeId ( forest8 );
1296  last_local_tree = pXest_get_last_local_treeId ( forest8 );
1297  }
1298 
1299  // Some debug ouput
1300  if ( my_rank == master_rank )
1301  {
1302  LOG_DEBUG ( 2, "Graph Partitioning: " << string_from_range ( graph_part.begin ( ), graph_part.end ( ) ) );
1303  LOG_DEBUG ( 2, "Old_to_new_tree permutation: " << string_from_range ( old_to_new_tree.begin ( ), old_to_new_tree.end ( ) ) );
1304  LOG_DEBUG ( 2, "Forest Partitioning: " << string_from_range ( partitioning.begin ( ), partitioning.end ( ) ) );
1305 
1306  if ( DEBUG_LEVEL >= 2 )
1307  {
1308  EntityToQuadMap* ent2quad = master_mesh_pXest->get_db ( )->get_entity_to_quad_map ( tdim, 0 );
1309  for ( EntityToQuadMap::iterator it = ent2quad->begin ( ); it != ent2quad->end ( ); ++it )
1310  {
1311  LOG_DEBUG ( 2, " Coarse Entity id " << it->first << " maps to tree id " << it->second.tree );
1312  }
1313  }
1314  }
1315 
1316  // set quad_to_entity map in forest
1317  treeId num_local_trees = last_local_tree - first_local_tree + 1;
1318  for ( treeId l = 0; l < num_local_trees; ++l )
1319  {
1320  if ( tdim == 2 )
1321  {
1322  p4est_tree_t* tree = pXest_get_tree_in_forest ( forest4, l + first_local_tree );
1323  p4est_quadrant_t* quad = pXest_get_local_quad_in_tree ( tree, 0 );
1324  QuadData* q_ptr = pXest_get_quad_data_ptr ( quad );
1325 
1326  LOG_DEBUG ( 2, my_rank << ": cell id " << l << ", tree of quad " << q_ptr->get_tree_id ( ) << " owner " << q_ptr->get_owner_rank ( )
1327  << " quad_pointer " << quad << " quad_dataptr " << q_ptr );
1328  q_ptr->set_cell_id ( l, 0 );
1329  q_ptr->set_remote_cell_id ( l, 0 );
1330  }
1331  if ( tdim == 3 )
1332  {
1333  p8est_tree_t* tree = pXest_get_tree_in_forest ( forest8, l + first_local_tree );
1334  p8est_quadrant_t* quad = pXest_get_local_quad_in_tree ( tree, 0 );
1335  QuadData* q_ptr = pXest_get_quad_data_ptr ( quad );
1336 
1337  LOG_DEBUG ( 2, my_rank << ": cell id " << l << ", tree of quad " << q_ptr->get_tree_id ( ) << " owner " << q_ptr->get_owner_rank ( )
1338  << " quad_pointer " << quad << " quad_dataptr " << q_ptr );
1339 
1340  q_ptr->set_cell_id ( l, 0 );
1341  q_ptr->set_remote_cell_id ( l, 0 );
1342  }
1343  }
1344 
1345  // *********************************************************************
1346  // 2. partition mesh database, as before
1347  MeshPtr recv_mesh;
1348  if ( !parallel )
1349  {
1350  // only master has coarse mesh
1351  recv_mesh = create_distributed_mesh ( master_mesh_pXest, master_rank, comm, graph_part /*partitioning*/, IMPL_P4EST );
1352  }
1353  else
1354  {
1355  // every process has coarse mesh
1356  recv_mesh = extract_local_mesh ( master_mesh_pXest, master_rank, comm, graph_part /*partitioning*/, IMPL_P4EST );
1357  }
1358 
1359  // *********************************************************************
1360  // 3. additional p4est stuff
1361  assert ( recv_mesh != NULL );
1362  boost::intrusive_ptr<MeshPXest> recv_mesh_pXest = boost::static_pointer_cast<MeshPXest> ( recv_mesh );
1363 
1364  // pass connectivity and forest to mesh database
1365  if ( tdim == 2 )
1366  {
1367  recv_mesh_pXest->get_db ( )->set_p4est_conn ( conn4 );
1368  recv_mesh_pXest->get_db ( )->set_p4est_forest ( forest4 );
1369  recv_mesh_pXest->update_cell_index_in_quads ( true );
1370 
1371  }
1372  if ( tdim == 3 )
1373  {
1374  recv_mesh_pXest->get_db ( )->set_p8est_conn ( conn8 );
1375  recv_mesh_pXest->get_db ( )->set_p8est_forest ( forest8 );
1376  recv_mesh_pXest->update_cell_index_in_quads ( true );
1377  }
1378 
1379  // store mesh in database
1380  recv_mesh_pXest->get_db ( )->set_mesh ( recv_mesh, 0 );
1381 
1382  // distribute coarse_entity_to_quad maps for cells and pass to database
1383  EntityToQuadMap map;
1384  EntityToQuadMap* coarse_map_ptr;
1385  std::vector<Id> coarse_cell_ids ( partitioning.size ( ), -1 );
1386  std::vector<Id> local_cell_ids ( partitioning.size ( ), -1 );
1387  if ( my_rank == seq_rank )
1388  {
1389  //boost::intrusive_ptr<MeshPXest> master_mesh_pXest = boost::static_pointer_cast<MeshPXest> (master_mesh);
1390  coarse_map_ptr = master_mesh_pXest->get_db ( )->get_entity_to_quad_map ( tdim, 0 );
1391 
1392  for ( EntityIterator it = master_mesh_pXest->begin ( tdim ); it != master_mesh_pXest->end ( tdim ); ++it )
1393  {
1394  int jc = std::distance ( master_mesh_pXest->begin ( tdim ), it );
1395  assert ( jc < partitioning.size ( ) );
1396  coarse_cell_ids[jc] = it->id ( );
1397  }
1398  LOG_DEBUG ( 2, "Rank " << my_rank << ": coarse_cell_ids " << string_from_range ( coarse_cell_ids.begin ( ), coarse_cell_ids.end ( ) ) );
1399  }
1400  else
1401  {
1402  coarse_map_ptr = NULL;
1403  }
1404 
1405  // get local cell ids
1406  int local_cell_counter = 0;
1407  for ( int jc = 0; jc < partitioning.size ( ); ++jc )
1408  {
1409  if ( graph_part[jc] /*partitioning[jc]*/ == my_rank )
1410  {
1411  local_cell_ids[jc] = local_cell_counter;
1412  ++local_cell_counter;
1413  }
1414  }
1415 
1416  LOG_DEBUG ( 2, "Rank " << my_rank << ": local_cell_ids " << string_from_range ( local_cell_ids.begin ( ), local_cell_ids.end ( ) ) );
1417 
1418  // distribute entity_to_quad maps
1419  if ( !parallel )
1420  {
1421  pXest_distribute_coarse_maps ( comm, master_rank, graph_part /*partitioning*/, coarse_cell_ids, local_cell_ids, coarse_map_ptr, map );
1422  }
1423  else
1424  {
1425  pXest_extract_local_maps ( comm, master_rank, graph_part /*partitioning*/, coarse_cell_ids, local_cell_ids, coarse_map_ptr, map );
1426  }
1427 
1428  recv_mesh_pXest->get_db ( )->set_entity_to_quad_map ( tdim, 1, map );
1429 
1430  return recv_mesh;
1431 #else
1432  return master_mesh;
1433 #endif
1434  }
std::map< Id, QuadCoord > EntityToQuadMap
Definition: pXest_structs.h:49
int32_t treeId
Definition: pXest_structs.h:48
#define LOG_DEBUG(lvl, stream)
Definition: log.h:221
void compute_dual_graph(const Mesh &mesh, Graph *graph)
Compute the dual graph of a mesh.
Definition: partitioning.cc:66
mesh::MeshPtr extract_local_mesh(const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, std::vector< int > &partitioning, mesh::IMPL impl)
Definition: mesh_tools.cc:491
T * vec2ptr(std::vector< T > &vec)
Conversion from vector to pointer to first element.
Definition: pointers.h:57
const int DEBUG_LEVEL
Definition: mesh_tools.cc:45
std::string string_from_range(const Iterator &begin, const Iterator &end)
Create a string representation of a range.
Definition: log.h:146
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58
int QuadData_size(int tdim)
return size of struct QuadData in bytes
mesh::MeshPtr create_distributed_mesh(const mesh::MeshPtr master_mesh, const int master_rank, const MPI_Comm &comm, std::vector< int > &partitioning, mesh::IMPL impl)
creates a distributed mesh from sequential master_mesh for a given partitioning
Definition: mesh_tools.cc:368

◆ permute_vector()

template<class T >
void hiflow::permute_vector ( const std::vector< int > &  permutation,
const std::vector< T > &  in_values,
std::vector< T > &  out_values 
)

Permute a vector.

Definition at line 67 of file permutation.h.

Referenced by hiflow::EvalDerivativeFeFunction< LAD, DIM >::EvalDerivativeFeFunction(), hiflow::EvalFeFunction< LAD >::EvalFeFunction(), hiflow::EvalFeFunction2< LAD >::EvalFeFunction2(), hiflow::mesh::MeshDbView::extract_boundary_mesh(), and hiflow::mesh::RefinedMeshDbView::RefinedMeshDbView().

69  {
70  const size_t N = in_values.size ( );
71  out_values.resize ( N );
72 
73  assert ( *std::min_element ( permutation.begin ( ), permutation.end ( ) ) == 0 );
74  assert ( *std::max_element ( permutation.begin ( ), permutation.end ( ) ) == N - 1 );
75 
76  for ( size_t i = 0; i < N; ++i )
77  {
78  out_values[i] = in_values[permutation[i]];
79  }
80  }

◆ precise_string_from_range()

template<typename Iterator >
std::string hiflow::precise_string_from_range ( const Iterator &  begin,
const Iterator &  end 
)

Create a high-precision string representation of a range of floating-point numbers.

It must be possible to output the elements of the range with operator<<.

Parameters
[in]beginiterator to beginning of range
[in]enditerator to end of range
Returns
std::string with space-delimited representation of elements in the range, with 16-digit precision.

Definition at line 166 of file log.h.

Referenced by hiflow::HpVectorAssembly< DataType >::add(), and hiflow::HpFemAssembler< DataType >::assemble_matrix_boundary_impl().

167  {
168  std::stringstream stream;
169  stream.precision ( 16 );
170  std::copy ( begin, end, std::ostream_iterator<typename std::iterator_traits<Iterator>::value_type > ( stream, " " ) );
171  return stream.str ( );
172  }
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type begin(const T &c)

◆ read_binary() [1/3]

template<class T >
void hiflow::read_binary ( std::istream &  is,
T &  val 
)
inline

Definition at line 35 of file binary_io.h.

Referenced by read_binary().

36  {
37  char bytes[sizeof (T )];
38 
39  // read separate bytes
40  is.read ( static_cast < char* > ( &bytes[0] ), sizeof (T ) );
41 
42  // construct value bytewise
43  std::memset ( &val, 0x0, sizeof (T ) ); // initialize with 0
44  for ( int i = 0; i < sizeof (T ); ++i )
45  {
46  // set n:th byte (little-endian)
47  *( reinterpret_cast < char* > ( &val ) + i ) |= bytes[i];
48  }
49  }

◆ read_binary() [2/3]

template<class T >
void hiflow::read_binary ( std::istream &  is,
std::vector< T > &  val 
)
inline

Definition at line 53 of file binary_io.h.

References read_binary().

54  {
55  array_size_t sz;
56  read_binary ( is, sz );
57 
58  std::vector<char> buf ( sz * sizeof (T ) );
59  if ( sz > 0 )
60  {
61  is.read ( reinterpret_cast < char* > ( &buf[0] ), sz * sizeof (T ) );
62  }
63  }
void read_binary(std::istream &is, std::string &str)
Definition: binary_io.h:66
unsigned array_size_t
Functions to read and write binary strings.
Definition: binary_io.h:28

◆ read_binary() [3/3]

void hiflow::read_binary ( std::istream &  is,
std::string &  str 
)
inline

Definition at line 66 of file binary_io.h.

References read_binary().

67  {
68  array_size_t sz;
69  read_binary ( is, sz );
70  std::vector<char> buf ( sz * sizeof (char ) );
71  if ( sz > 0 )
72  {
73  is.read ( &buf[0], sz * sizeof (char ) );
74  str = std::string ( &buf[0], sz );
75  }
76  }
void read_binary(std::istream &is, std::string &str)
Definition: binary_io.h:66
unsigned array_size_t
Functions to read and write binary strings.
Definition: binary_io.h:28

◆ read_mesh_from_file()

mesh::MeshPtr hiflow::read_mesh_from_file ( const std::string &  filename,
TDim  tdim,
GDim  gdim,
const MPI_Comm *  comm,
std::vector< MasterSlave period,
IMPL  impl 
)

Read in a mesh from a file.

General interface /////////////////////

The file type is determined from the filename suffix. MPI communicator is necessary for reading parallel Vtk files. In this case, the returned mesh is only the local part of the mesh.

Parameters
filenameName of the file to read.
tdimTopological dimension of mesh.
gdimGeometrical dimension of mesh.
commMPI communicatior for parallel input. Can be 0 for sequential input.
Returns
Shared pointer to created mesh object.

General interface /////////////////////

Definition at line 65 of file mesh_tools.cc.

References hiflow::mesh::IMPL_DBVIEW, hiflow::mesh::IMPL_P4EST, LOG_ERROR, hiflow::mesh::Reader::read(), and hiflow::mesh::ReadGridException::what().

71  {
72  // find position of last '.'
73  int dot_pos = filename.find_last_of ( "." );
74  assert ( dot_pos != static_cast < int > ( std::string::npos ) );
75  std::string suffix = filename.substr ( dot_pos );
76 
77  // choose reader according to filename suffix
78  Reader* reader;
79  MeshBuilder* builder;
80  assert ( impl == IMPL_P4EST || impl == IMPL_DBVIEW );
81 
82  if ( impl == IMPL_P4EST )
83  {
84 #ifdef WITH_P4EST
85  builder = new MeshPXestBuilder ( tdim, gdim, period );
86 #else
87  LOG_ERROR ( "Not compiled with p4ests support!" );
88  exit ( -1 );
89 #endif
90  }
91  else if ( impl == IMPL_DBVIEW )
92  builder = new MeshDbViewBuilder ( tdim, gdim, period );
93 
94  if ( suffix == std::string ( ".inp" ) )
95  {
96  assert ( impl == IMPL_P4EST || impl == IMPL_DBVIEW );
97 
98  if ( impl == IMPL_P4EST )
99  {
100 #ifdef WITH_P4EST
101  reader = new UcdPXestReader ( builder );
102 #else
103  LOG_ERROR ( "Not compiled with p4ests support!" );
104  exit ( -1 );
105 #endif
106  }
107  else if ( impl == IMPL_DBVIEW )
108  reader = new UcdReader ( builder );
109  }
110  else if ( suffix == std::string ( ".vtu" ) )
111  {
112  assert ( impl == IMPL_DBVIEW );
113  reader = new VtkReader ( builder );
114  }
115  else if ( suffix == std::string ( ".pvtu" ) )
116  {
117  assert ( comm != 0 );
118  assert ( impl == IMPL_DBVIEW );
119  reader = new PVtkReader ( builder, *comm );
120  }
121 
122  // try to read the mesh
123  MeshPtr mesh;
124  try
125  {
126  reader->read ( filename.c_str ( ), mesh );
127  delete reader;
128  }
129  catch ( const ReadGridException& exc )
130  {
131  delete reader;
132 
133  std::cerr << "Failed to read " << filename << "\n";
134  std::cerr << exc.what ( ) << "\n";
135 
136  throw exc;
137  }
138  MeshPtr shared_mesh ( mesh );
139 
140  // TODO fix segmentation fault that occurs when uncommenting the following line
141  // delete builder;
142  return shared_mesh;
143  }
#define LOG_ERROR(stream)
Log an error message to the log "error".
Definition: log.h:233
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58

◆ read_partitioned_mesh()

mesh::MeshPtr hiflow::read_partitioned_mesh ( const std::string &  filename,
mesh::TDim  tdim,
mesh::GDim  gdim,
const MPI_Comm &  comm 
)

Read a mesh partitioned using the partition_mesh utility.

Reads volume mesh from PVtk file and boundary mesh from corresponding Vtk file with ending '_bdy.vtu', in order to obtain the material ids for the boundary facets. Returns the volume mesh, which does not include ghost cells.

Definition at line 855 of file mesh_tools.cc.

References hiflow::mesh::MeshDbViewBuilder::get_db(), and hiflow::mesh::Reader::read().

859  {
860  MeshDbViewBuilder mb ( tdim, gdim );
861 
862  // Read parallel mesh file on all processes.
863  MeshPtr local_mesh;
864  PVtkReader reader ( &mb, comm );
865  reader.read ( filename.c_str ( ), local_mesh );
866 
867  // Read boundary file on all processes, to get boundary material numbers.
868  int point_pos = filename.find_last_of ( '.' );
869  const std::string boundary_filename = filename.substr ( 0, point_pos ) + std::string ( "_bdy.vtu" );
870 
871  MeshDbViewBuilder bdy_mb ( mb.get_db ( ) );
872  VtkReader bdy_reader ( &bdy_mb );
873  MeshPtr bmesh;
874  bdy_reader.read ( boundary_filename.c_str ( ), bmesh );
875 
876  return local_mesh;
877  }
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58

◆ reset()

template<bool Timer>
void hiflow::reset ( ScopedTimer timer)

Referenced by stop< true >().

◆ reset< false >()

template<>
void hiflow::reset< false > ( ScopedTimer timer)
inline

Definition at line 151 of file ScopedTimer.h.

152  {
153  }

◆ reset< true >()

template<>
void hiflow::reset< true > ( ScopedTimer timer)
inline

Definition at line 156 of file ScopedTimer.h.

References hiflow::ScopedTimer::repetition().

157  {
158  timer->repetition ( );
159  }

◆ save_mesh()

void hiflow::save_mesh ( std::string  filename,
const MeshPtr  mesh,
const MPI_Comm &  comm 
)

Save a mesh in a hdf5 file.

Definition at line 145 of file mesh_tools.cc.

References hiflow::mesh::RefinedMeshDbView::get_all_ancestors(), hiflow::mesh::MeshPXest::get_db(), hiflow::mesh::MeshDbView::get_db(), hiflow::mesh::MeshPXest::get_history_index(), and hiflow::mesh::MeshDbView::save().

Referenced by hiflow::DynamicMeshHandler< LAD, MESH_IMPL, DIM >::save_mesh_to_file().

146  {
147 #ifdef WITH_HDF5
148  int tdim = mesh->tdim();
149  int gdim = mesh->gdim();
150  std::size_t pos_suffix = filename.find_last_of ( "." );
151 
152  std::string filename_without_suffix = filename.substr ( 0, pos_suffix );
153 
154  assert ( !filename_without_suffix.empty ( ) );
155 
156  std::string suffix = ".h5";
157 
158  filename = filename_without_suffix + suffix;
159 
160  const Mesh* mesh_ptr = mesh.get ( );
161  const MeshDbView* mesh_db_view_ptr;
162  const RefinedMeshDbView* refined_mesh_ptr;
163  const MeshPXest* pXest_ptr;
164 
165  {
166  H5FilePtr file_ptr ( new H5File ( filename, "w", comm ) );
167  //SETTING UP HDF5 GROUP
168  std::stringstream groupname;
169  groupname << "Mesh";
170  H5GroupPtr group_ptr ( new H5Group ( file_ptr, groupname.str ( ), "w" ) );
171  write_array_parallel ( group_ptr, "tdim", &tdim, 1, comm );
172  write_array_parallel ( group_ptr, "gdim", &gdim, 1, comm );
173  }
174 
175  if ( ( pXest_ptr = dynamic_cast < const MeshPXest* > ( mesh_ptr ) ) != 0 )
176  {
177  int history_index = pXest_ptr->get_history_index ( );
178  pXest_ptr->get_db ( )->save ( filename, comm );
179  std::map< Id, MeshPtr> mesh_history = pXest_ptr->get_db ( )->get_mesh_history ( );
180  int counter = 0;
181  for ( std::map< Id, MeshPtr>::const_iterator it = mesh_history.begin ( ); it != mesh_history.end ( ); ++it )
182  {
183  std::stringstream filenamei;
184  filenamei << filename_without_suffix << "." << counter << suffix;
185  it->second->save ( filenamei.str ( ), comm );
186  ++counter;
187  }
188  H5FilePtr file_ptr ( new H5File ( filename, "w", comm ) );
189  //SETTING UP HDF5 GROUP
190  std::stringstream groupname;
191  groupname << "HistoryMeshs";
192  H5GroupPtr group_ptr ( new H5Group ( file_ptr, groupname.str ( ), "w" ) );
193  write_array_parallel ( group_ptr, "num_history_meshes", &counter, 1, comm );
194  write_array_parallel ( group_ptr, "history_index", &history_index, 1, comm );
195  }
196  else if ( ( refined_mesh_ptr = dynamic_cast < const RefinedMeshDbView* > ( mesh_ptr ) ) != 0 )
197  {
198  refined_mesh_ptr->MeshDbView::save ( filename, comm );
199  refined_mesh_ptr->get_db ( )->save ( filename, comm );
200  std::vector<ConstMeshPtr> history = refined_mesh_ptr->get_all_ancestors ( );
201  int num_meshes = history.size ( );
202  for ( int i = 0; i < num_meshes; ++i )
203  {
204  std::stringstream filenamei;
205  filenamei << filename_without_suffix << "." << i << suffix;
206  const Mesh* conv_ptr = history[i].get ( );
207  assert ( dynamic_cast < const MeshDbView* > ( conv_ptr ) != NULL );
208  dynamic_cast < const MeshDbView* > ( conv_ptr )->MeshDbView::save ( filenamei.str ( ), comm );
209  }
210 
211  H5FilePtr file_ptr ( new H5File ( filename, "w", comm ) );
212  //SETTING UP HDF5 GROUP
213  std::stringstream groupname;
214  groupname << "RefinedMeshDbView";
215  H5GroupPtr group_ptr ( new H5Group ( file_ptr, groupname.str ( ), "w" ) );
216  write_array_parallel ( group_ptr, "num_history_meshes", &num_meshes, 1, comm );
217 
218  }
219  else if ( ( mesh_db_view_ptr = dynamic_cast < const MeshDbView* > ( mesh_ptr ) ) != 0 )
220  {
221  mesh_db_view_ptr->MeshDbView::save ( filename, comm );
222  mesh_db_view_ptr->get_db ( )->save ( filename, comm );
223  }
224  else
225  {
226  mesh->Mesh::save ( filename, comm );
227  }
228 #else
229  throw "HiFlow was not compiled with HDF5 support!\n";
230 #endif
231  }
Abstract base class for mesh implementations.

◆ set_default_material_number_on_bdy() [1/2]

void hiflow::set_default_material_number_on_bdy ( mesh::MeshPtr  mesh,
MaterialNumber  default_value 
)

Sets a default value for the material number of all boundary facets with material number -1. Useful to distinguish between boundary facets created by the partion-process and "real"/physical boundary facets.

Definition at line 879 of file mesh_tools.cc.

880  {
881  MeshPtr bdy_mesh = mesh->extract_boundary_mesh ( );
882 
883  set_default_material_number_on_bdy ( mesh, bdy_mesh, default_value );
884  }
void set_default_material_number_on_bdy(mesh::MeshPtr mesh, mesh::MeshPtr bdy_mesh, MaterialNumber default_value)
Definition: mesh_tools.cc:886
boost::intrusive_ptr< Mesh > MeshPtr
Types for Mesh pointers.
Definition: types.h:58

◆ set_default_material_number_on_bdy() [2/2]

void hiflow::set_default_material_number_on_bdy ( mesh::MeshPtr  mesh,
mesh::MeshPtr  bdy_mesh,
MaterialNumber  default_value 
)

Definition at line 886 of file mesh_tools.cc.

887  {
888  mesh::TDim mesh_tdim = mesh->tdim ( );
889 
890  const EntityIterator facet_begin = bdy_mesh->begin ( mesh_tdim - 1 );
891  const EntityIterator facet_end = bdy_mesh->end ( mesh_tdim - 1 );
892 
893  for ( EntityIterator it = facet_begin; it != facet_end; it++ )
894  {
895  int mesh_facet_index;
896  bdy_mesh->get_attribute_value ( "_mesh_facet_index_", mesh_tdim - 1, it->index ( ), &mesh_facet_index );
897  MaterialNumber former_number = mesh->get_material_number ( mesh_tdim - 1, mesh_facet_index );
898  if ( former_number == -1 )
899  {
900  mesh->set_material_number ( mesh_tdim - 1, mesh_facet_index, default_value );
901  }
902  }
903 
904  }
int MaterialNumber
Type for the material number.
Definition: types.h:86
int TDim
Definition: types.h:79

◆ sign()

template<class DataType >
Mat<3, 3, DataType>::value_type hiflow::sign ( size_t  i,
size_t  j 
)
inline

Definition at line 659 of file vector_algebra.h.

660  {
661  return (i + j ) % 2 == 0 ? 1. : -1.;
662  }

◆ sort_elements()

template<class DataType >
void hiflow::sort_elements ( const VectorSpace< DataType > &  space,
std::vector< int > &  iteration_order 
)
inline

◆ sortingPermutation()

template<class T >
void hiflow::sortingPermutation ( const std::vector< T > &  values,
std::vector< int > &  v 
)

Function to get the corresponding permutation for sorting of values vector. Permutation vector is allocated inside the function.

Parameters
[in]valuesVector of values to get the sorting permutation for
[out]vPermutation vector

Definition at line 65 of file sort_permutation.h.

References CreateCmpPairs().

Referenced by hiflow::DynamicMeshProblem< LAD, MESH_IMPL, DIM >::adapt_mesh_change_list(), hiflow::StandardVectorAssembly< AlgorithmType, DataType >::add(), hiflow::StandardMatrixAssembly< AlgorithmType, DataType >::add(), add_global(), and local_fixed_fraction_strategy().

66  {
67  size_t size = values.size ( );
68  v.clear ( );
69  v.reserve ( size );
70  for ( size_t i = 0; i != size; ++i )
71  v.push_back ( i );
72 
73  std::stable_sort ( v.begin ( ), v.end ( ), CreateCmpPairs ( values ) );
74  ;
75 
76  }
CmpPairs< T > CreateCmpPairs(const std::vector< T > &v)
Creator function for CmpPairs.

◆ start()

template<bool Timer>
void hiflow::start ( ScopedTimer timer)

◆ start< false >()

template<>
void hiflow::start< false > ( ScopedTimer timer)
inline

Definition at line 117 of file ScopedTimer.h.

118  {
119  }

◆ start< true >()

template<>
void hiflow::start< true > ( ScopedTimer timer)
inline

Definition at line 122 of file ScopedTimer.h.

References cuda_sync_threads(), and hiflow::ScopedTimer::stop().

123  {
124 # ifdef WITH_CUDA
125  cuda_sync_threads ( );
126 # endif
127  timer->start ( );
128  }
void cuda_sync_threads(void)

◆ stop()

template<bool Timer>
void hiflow::stop ( ScopedTimer timer)

◆ stop< false >()

template<>
void hiflow::stop< false > ( ScopedTimer timer)
inline

Definition at line 134 of file ScopedTimer.h.

135  {
136  }

◆ stop< true >()

template<>
void hiflow::stop< true > ( ScopedTimer timer)
inline

Definition at line 139 of file ScopedTimer.h.

References cuda_sync_threads(), reset(), and hiflow::ScopedTimer::stop().

140  {
141 # ifdef WITH_CUDA
142  cuda_sync_threads ( );
143 # endif
144  timer->stop ( );
145  }
void cuda_sync_threads(void)

◆ string_from_pointer_range()

template<typename ValueType >
std::string hiflow::string_from_pointer_range ( const ValueType *  begin,
const ValueType *  end 
)

Create a string representation of a pointer range.

It must be possible to output the elements of the range with operator<<.

Todo:
This function is a copy of string_from_range(), and it should be possible to replace its use with that function.
Parameters
[in]beginpointer to beginning of range
[in]endpointer to end of range
Returns
std::string with space-delimited representation of elements in the range.

Definition at line 187 of file log.h.

Referenced by hiflow::doffem::NumberingLagrange< DataType >::print_interface_patterns().

188  {
189  std::stringstream stream;
190  std::copy ( begin, end, std::ostream_iterator<ValueType>( stream, " " ) );
191  return stream.str ( );
192  }
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type begin(const T &c)

◆ string_from_range()

template<typename Iterator >
std::string hiflow::string_from_range ( const Iterator &  begin,
const Iterator &  end 
)

Create a string representation of a range.

It must be possible to output the elements of the range with operator<<.

Parameters
[in]beginiterator to beginning of range
[in]enditerator to end of range
Returns
std::string with space-delimited representation of elements in the range.

Definition at line 146 of file log.h.

Referenced by hiflow::DynamicMeshProblem< LAD, MESH_IMPL, DIM >::adapt_mesh_change_list(), hiflow::HpVectorAssembly< DataType >::add(), hiflow::HpMatrixAssembly< DataType >::add(), hiflow::mesh::MeshPXestDatabase::add_cell_to_mesh_maps(), hiflow::mesh::MeshPXest::add_cells_and_rebuild(), hiflow::mesh::MeshPXest::add_ghost_cells(), hiflow::DynamicMeshHandler< LAD, MESH_IMPL, DIM >::add_mesh_change_times(), hiflow::TimeMesh< typename LAD::DataType >::add_time(), hiflow::doffem::DofInterpolation::apply_permutation(), hiflow::DGGlobalAssembler< DataType >::assemble_interface_multiple_scalar_cells(), hiflow::HpFemAssembler< DataType >::assemble_matrix_boundary_impl(), hiflow::mesh::MpiScatter::communicate(), hiflow::mesh::compute_interface_pattern(), hiflow::doffem::NumberingLagrange< DataType >::compute_interpolation(), hiflow::mesh::MeshDbView::compute_refined_cells(), hiflow::mesh::MeshPXest::compute_refined_cells_recursive(), hiflow::mesh::compute_refined_cells_recursive(), hiflow::doffem::NumberingLagrange< DataType >::compute_weights(), create_distributed_mesh(), hiflow::mesh::MeshDatabase::create_entity(), hiflow::XdmfBaseItem::dim_to_string(), hiflow::mesh::MeshDbView::extract_boundary_mesh(), extract_local_mesh(), hiflow::mesh::VertexConnectivity::find_entity(), hiflow::VectorSpace< typename LAD::DataType >::Init(), hiflow::doffem::FEType< LAD_high ::DataType >::init_dofs_on_subentities(), hiflow::DynamicMeshHandler< LAD, MESH_IMPL, DIM >::init_fe_spaces(), hiflow::la::CoupledVector< DataType >::InitializePostProcessing(), hiflow::la::PETScVector< DataType >::InitializePostProcessing(), hiflow::la::HypreVector< DataType >::InitializePostProcessing(), hiflow::la::CoupledMatrix< DataType >::InitStructure(), hiflow::mesh::RefinedMeshDbView::is_boundary_facet(), hiflow::mesh::MeshDbView::is_boundary_facet(), hiflow::TimeMesh< typename LAD::DataType >::load_all(), hiflow::TimeMesh< typename LAD::DataType >::make_regular(), hiflow::mesh::MeshDbView::MeshDbView(), hiflow::doffem::NumberingLagrange< DataType >::number(), hiflow::mesh::operator<<(), partition_and_distribute_pXest(), hiflow::la::PpVector< LAD >::Print(), hiflow::mesh::project_point(), hiflow::mesh::UcdReader::read_file(), hiflow::mesh::UcdPXestReader::read_file(), hiflow::mesh::MeshPXest::rebuild(), hiflow::doffem::DofInterpolation::reduce_from_above(), hiflow::doffem::DofInterpolation::reduce_from_below(), hiflow::mesh::MeshPXest::refine(), hiflow::doffem::DofPartition< DataType >::renumber(), hiflow::Visualization< DataType >::set_var_names(), hiflow::mesh::unpack_ghost_data(), and hiflow::mesh::PVtkWriter::write_file().

147  {
148  std::stringstream stream;
149  std::copy ( begin, end, std::ostream_iterator<typename std::iterator_traits<Iterator>::value_type > ( stream, " " ) );
150  return stream.str ( );
151  }
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type begin(const T &c)

◆ sum()

template<size_t N, class DataType >
Vec<N, DataType>::value_type hiflow::sum ( const Vec< N, DataType > &  v)
inline

◆ trace()

template<size_t M, class DataType >
DataType hiflow::trace ( const Mat< M, M, DataType > &  m)
inline

Trace of a quadratic matrix.

Definition at line 886 of file vector_algebra.h.

887  {
888  DataType trace = 0;
889 # pragma clang loop vectorize(enable)
890  for ( size_t i = 0; i < M; ++i )
891  {
892  trace += m ( i, i );
893  }
894  return trace;
895  }
DataType trace(const Mat< M, M, DataType > &m)
Trace of a quadratic matrix.

◆ trans()

template<size_t M, size_t N, class DataType >
void hiflow::trans ( const Mat< M, N, DataType > &  m,
Mat< N, M, DataType > &  m_trans 
)
inline

Transpose of a general matrix.

Definition at line 852 of file vector_algebra.h.

Referenced by hiflow::EvalMappedShapeFunctionHessians< DIM, DataType >::operator()(), and hiflow::EvalSurfaceElement< DIM, DataType >::operator()().

853  {
854 # pragma clang loop vectorize(enable)
855  for ( size_t i = 0; i < N; ++i )
856  {
857  for ( size_t j = 0; j < M; ++j )
858  {
859  m_trans ( i, j ) = m ( j, i );
860  }
861  }
862  }

◆ vec2ptr() [1/2]

template<class T >
T* hiflow::vec2ptr ( std::vector< T > &  vec)

Conversion from vector to pointer to first element.

Definition at line 57 of file pointers.h.

Referenced by hiflow::la::CoupledVector< DataType >::Add(), hiflow::la::HypreMatrix< DataType >::Add(), hiflow::la::CoupledMatrix< DataType >::Add(), hiflow::StandardVectorAssembly< AlgorithmType, DataType >::add(), hiflow::StandardMatrixAssembly< AlgorithmType, DataType >::add(), hiflow::mesh::DistributedBuilder::add_entities(), hiflow::mesh::DistributedBuilder::add_entity(), add_global(), hiflow::mesh::MeshDbViewBuilder::add_vertex(), hiflow::mesh::MeshDbViewBuilder::add_vertices(), hiflow::la::PreconditionerVanka< LAD >::ApplyPreconditioner(), hiflow::la::gmg::LinearRestriction< LAD >::build_restriction_matrix(), hiflow::la::HypreVector< DataType >::CloneFromWithoutContent(), hiflow::mesh::MpiBroadcast::communicate(), hiflow::mesh::MpiScatter::communicate(), hiflow::mesh::MpiNonBlockingPointToPoint::communicate(), hiflow::mesh::communicate_ghost_cells(), hiflow::mesh::MeshDbView::compute_refined_cells(), hiflow::mesh::MeshPXest::compute_refined_cells_recursive(), hiflow::la::HypreVector< DataType >::CopyFrom(), hiflow::la::HypreVector< DataType >::CopyFromWithoutGhost(), hiflow::la::gmg::BasicLevel< LAD >::create_matrix(), hiflow::la::PreconditionerVanka< LAD >::CreateLocalMatrices(), hiflow::la::HypreMatrix< DataType >::diagonalize_rows(), hiflow::la::PETScMatrix< DataType >::diagonalize_rows(), hiflow::mesh::distribute_graph_naive(), hiflow::AssemblyAssistant< DIM, DataType >::extract_dof_values(), hiflow::la::TriBlock< LAD >::FilterSubVector(), hiflow::la::SchurComplement< LAD >::FilterVector(), hiflow::mesh::MeshDbView::find_vertex(), hiflow::la::SeqDenseMatrix< DataType >::ForwardBackward(), hiflow::la::PETScVector< DataType >::GetAllDofsAndValues(), hiflow::la::HypreVector< DataType >::GetAllDofsAndValues(), hiflow::la::HypreMatrix< DataType >::GetValues(), hiflow::la::CoupledMatrix< DataType >::GetValues(), hiflow::la::PETScVector< DataType >::GetValues(), hiflow::la::HypreVector< DataType >::GetValues(), hiflow::la::HypreVector< DataType >::Init(), hiflow::la::SchurComplement< LAD >::Init(), hiflow::la::gmg::BasicLevel< LAD >::init_boundary_conditions(), hiflow::la::gmg::BasicLevel< LAD >::init_la(), initialize_linear_algebra_objects(), hiflow::la::HypreMatrix< DataType >::InitStructure(), hiflow::la::PETScMatrix< DataType >::InitStructure(), hiflow::mesh::MeshDbView::move_vertex(), hiflow::mesh::MeshDbView::move_vertices(), partition_and_distribute_pXest(), hiflow::mesh::NaiveGraphPartitioner::partition_graph(), hiflow::la::HypreMatrix< DataType >::print_statistics(), hiflow::la::gmg::LinearCellRestrictor< LAD >::process_dof(), hiflow::la::gmg::util::raw_array(), hiflow::la::CoupledVector< DataType >::ReadHDF5(), hiflow::doffem::DofPartition< DataType >::renumber(), hiflow::mesh::MeshDbView::replace_vertex(), hiflow::la::HypreMatrix< DataType >::Scale(), hiflow::la::SchurComplement< LAD >::SchurPrecond(), hiflow::la::PETScVector< DataType >::SendBorder(), hiflow::la::HypreVector< DataType >::SendBorder(), hiflow::la::SchurComplement< LAD >::SetupBlockTwoMatrix(), hiflow::la::SchurComplement< LAD >::SetupOperator(), hiflow::la::TriBlock< LAD >::SetupOperator(), hiflow::la::TriBlock< LAD >::SetupOperatorE(), hiflow::la::SchurComplement< LAD >::SetupOperatorF(), hiflow::la::SchurComplement< LAD >::SetupOperatorH(), hiflow::la::SchurComplement< LAD >::SetupOperatorQ(), hiflow::la::SLEPcEigenSolver< LAD >::SetupPetscMat(), hiflow::la::HypreMatrix< DataType >::SetValues(), hiflow::la::PETScMatrix< DataType >::SetValues(), hiflow::la::TriBlock< LAD >::Solve(), hiflow::la::SchurComplement< LAD >::Solve(), hiflow::la::TriBlock< LAD >::SolveBlock(), hiflow::la::SchurComplement< LAD >::SolveBlockA(), hiflow::mesh::unpack_ghost_data(), hiflow::mesh::update_shared_vertex_table(), hiflow::la::CoupledMatrix< DataType >::VectorMult_submatrix(), hiflow::la::CoupledMatrix< DataType >::VectorMult_submatrix_vanka(), hiflow::mesh::CellType::vertices_of_entity(), hiflow::la::HypreVector< DataType >::WriteHDF5(), and hiflow::la::HypreMatrix< DataType >::Zeros().

58  {
59  return vec.empty ( ) ? 0 : &( vec[0] );
60  }

◆ vec2ptr() [2/2]

template<class T >
const T* hiflow::vec2ptr ( const std::vector< T > &  vec)

Conversion from const vector to pointer to first element.

Definition at line 65 of file pointers.h.

66  {
67  return vec.empty ( ) ? 0 : &( vec[0] );
68  }

◆ write_binary() [1/3]

template<class T >
void hiflow::write_binary ( std::ostream &  os,
val 
)
inline

Definition at line 80 of file binary_io.h.

Referenced by write_binary().

81  {
82  char bytes[sizeof (T )];
83 
84  // extract bytes from val
85  for ( int i = 0; i < sizeof (T ); ++i )
86  {
87  bytes[i] = ( *( reinterpret_cast < char* > ( &val ) + i ) ) & 0xFF;
88  }
89 
90  os.write ( static_cast < char* > ( &bytes[0] ), sizeof (T ) );
91  }

◆ write_binary() [2/3]

template<class T >
void hiflow::write_binary ( std::ostream &  os,
const std::vector< T > &  vec 
)
inline

Definition at line 95 of file binary_io.h.

References write_binary().

96  {
97  write_binary ( os, static_cast < array_size_t > ( vec.size ( ) ) );
98 
99  if ( vec.size ( ) > 0 )
100  {
101  os.write ( reinterpret_cast < char* > ( const_cast < T* > ( &vec[0] ) ), vec.size ( ) * sizeof (T ) );
102  }
103  }
void write_binary(std::ostream &os, const std::string &str)
Definition: binary_io.h:106

◆ write_binary() [3/3]

void hiflow::write_binary ( std::ostream &  os,
const std::string &  str 
)
inline

Definition at line 106 of file binary_io.h.

References write_binary().

107  {
108  write_binary ( os, static_cast < array_size_t > ( str.size ( ) ) );
109 
110  if ( str.size ( ) > 0 )
111  {
112  os.write ( str.data ( ), str.size ( ) * sizeof (char ) );
113  }
114  }
void write_binary(std::ostream &os, const std::string &str)
Definition: binary_io.h:106

Variable Documentation

◆ _lagrange_coeff1

LagrangeCoeff hiflow::_lagrange_coeff1

Definition at line 25 of file lagrangecoeff1.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff10

LagrangeCoeff hiflow::_lagrange_coeff10

Definition at line 25 of file lagrangecoeff10.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff11

LagrangeCoeff hiflow::_lagrange_coeff11

Definition at line 25 of file lagrangecoeff11.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff12

LagrangeCoeff hiflow::_lagrange_coeff12

Definition at line 25 of file lagrangecoeff12.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff13

LagrangeCoeff hiflow::_lagrange_coeff13

Definition at line 24 of file lagrangecoeff13.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff14

LagrangeCoeff hiflow::_lagrange_coeff14

Definition at line 25 of file lagrangecoeff14.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff15

LagrangeCoeff hiflow::_lagrange_coeff15

Definition at line 25 of file lagrangecoeff15.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff16

LagrangeCoeff hiflow::_lagrange_coeff16

Definition at line 25 of file lagrangecoeff16.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff17

LagrangeCoeff hiflow::_lagrange_coeff17

Definition at line 25 of file lagrangecoeff17.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff18

LagrangeCoeff hiflow::_lagrange_coeff18

Definition at line 25 of file lagrangecoeff18.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff19

LagrangeCoeff hiflow::_lagrange_coeff19

Definition at line 25 of file lagrangecoeff19.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff2

LagrangeCoeff hiflow::_lagrange_coeff2

Definition at line 25 of file lagrangecoeff2.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff20

LagrangeCoeff hiflow::_lagrange_coeff20

Definition at line 25 of file lagrangecoeff20.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff3

LagrangeCoeff hiflow::_lagrange_coeff3

Definition at line 25 of file lagrangecoeff3.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff4

LagrangeCoeff hiflow::_lagrange_coeff4

Definition at line 25 of file lagrangecoeff4.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff5

LagrangeCoeff hiflow::_lagrange_coeff5

Definition at line 25 of file lagrangecoeff5.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff6

LagrangeCoeff hiflow::_lagrange_coeff6

Definition at line 25 of file lagrangecoeff6.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff7

LagrangeCoeff hiflow::_lagrange_coeff7

Definition at line 25 of file lagrangecoeff7.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff8

LagrangeCoeff hiflow::_lagrange_coeff8

Definition at line 25 of file lagrangecoeff8.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _lagrange_coeff9

LagrangeCoeff hiflow::_lagrange_coeff9

Definition at line 25 of file lagrangecoeff9.h.

Referenced by hiflow::LagrangePolynomial< double >::reinit().

◆ _poly_lagrange_coeff1

double hiflow::_poly_lagrange_coeff1[]
static
Initial value:
= {
1.000000000000000000000000000000e+00,
-1.000000000000000000000000000000e+00,
0.000000000000000000000000000000e+00,
1.000000000000000000000000000000e+00
}

Definition at line 23 of file lagrangecoeff1.cc.

◆ _poly_lagrange_coeff10

double hiflow::_poly_lagrange_coeff10[]
static

Definition at line 25 of file lagrangecoeff10.cc.

◆ _poly_lagrange_coeff11

double hiflow::_poly_lagrange_coeff11[]
static

Definition at line 25 of file lagrangecoeff11.cc.

◆ _poly_lagrange_coeff12

double hiflow::_poly_lagrange_coeff12[]
static

Definition at line 25 of file lagrangecoeff12.cc.

◆ _poly_lagrange_coeff13

double hiflow::_poly_lagrange_coeff13[]
static

Definition at line 25 of file lagrangecoeff13.cc.

◆ _poly_lagrange_coeff14

double hiflow::_poly_lagrange_coeff14[]
static

Definition at line 25 of file lagrangecoeff14.cc.

◆ _poly_lagrange_coeff15

double hiflow::_poly_lagrange_coeff15[]
static

Definition at line 25 of file lagrangecoeff15.cc.

◆ _poly_lagrange_coeff16

double hiflow::_poly_lagrange_coeff16[]
static

Definition at line 25 of file lagrangecoeff16.cc.

◆ _poly_lagrange_coeff17

double hiflow::_poly_lagrange_coeff17[]
static

Definition at line 25 of file lagrangecoeff17.cc.

◆ _poly_lagrange_coeff18

double hiflow::_poly_lagrange_coeff18[]
static

Definition at line 25 of file lagrangecoeff18.cc.

◆ _poly_lagrange_coeff19

double hiflow::_poly_lagrange_coeff19[]
static

Definition at line 25 of file lagrangecoeff19.cc.

◆ _poly_lagrange_coeff2

double hiflow::_poly_lagrange_coeff2[]
static
Initial value:
= {
1.000000000000000000000000000000e+00,
-3.000000000000000000000000000000e+00,
2.000000000000000000000000000000e+00,
0.000000000000000000000000000000e-01,
4.000000000000000000000000000000e+00,
-4.000000000000000000000000000000e+00,
0.000000000000000000000000000000e-01,
-1.000000000000000000000000000000e+00,
2.000000000000000000000000000000e+00
}

Definition at line 25 of file lagrangecoeff2.cc.

◆ _poly_lagrange_coeff20

double hiflow::_poly_lagrange_coeff20[]
static

Definition at line 25 of file lagrangecoeff20.cc.

◆ _poly_lagrange_coeff3

double hiflow::_poly_lagrange_coeff3[]
static
Initial value:
= {
1.000000000000000000000000000000e+00,
-5.500000000000000000000000000000e+00,
9.000000000000000000000000000000e+00,
-4.500000000000000000000000000000e+00,
0.000000000000000000000000000000e-01,
9.000000000000000000000000000000e+00,
-2.250000000000000000000000000000e+01,
1.350000000000000000000000000000e+01,
0.000000000000000000000000000000e-01,
-4.500000000000000000000000000000e+00,
1.800000000000000000000000000000e+01,
-1.350000000000000000000000000000e+01,
0.000000000000000000000000000000e-01,
1.000000000000000000000000000000e+00,
-4.500000000000000000000000000000e+00,
4.500000000000000000000000000000e+00
}

Definition at line 25 of file lagrangecoeff3.cc.

◆ _poly_lagrange_coeff4

double hiflow::_poly_lagrange_coeff4[]
static

Definition at line 25 of file lagrangecoeff4.cc.

◆ _poly_lagrange_coeff5

double hiflow::_poly_lagrange_coeff5[]
static

Definition at line 25 of file lagrangecoeff5.cc.

◆ _poly_lagrange_coeff6

double hiflow::_poly_lagrange_coeff6[]
static

Definition at line 25 of file lagrangecoeff6.cc.

◆ _poly_lagrange_coeff7

double hiflow::_poly_lagrange_coeff7[]
static

Definition at line 25 of file lagrangecoeff7.cc.

◆ _poly_lagrange_coeff8

double hiflow::_poly_lagrange_coeff8[]
static

Definition at line 25 of file lagrangecoeff8.cc.

◆ _poly_lagrange_coeff9

double hiflow::_poly_lagrange_coeff9[]
static

Definition at line 25 of file lagrangecoeff9.cc.

◆ _poly_x_lagrange_coeff1

double hiflow::_poly_x_lagrange_coeff1[]
static
Initial value:
= {
-1.000000000000000000000000000000e+00,
0.000000000000000000000000000000e+00,
1.000000000000000000000000000000e+00,
0.000000000000000000000000000000e+00
}

Definition at line 31 of file lagrangecoeff1.cc.

◆ _poly_x_lagrange_coeff10

double hiflow::_poly_x_lagrange_coeff10[]
static

Definition at line 161 of file lagrangecoeff10.cc.

◆ _poly_x_lagrange_coeff11

double hiflow::_poly_x_lagrange_coeff11[]
static

Definition at line 184 of file lagrangecoeff11.cc.

◆ _poly_x_lagrange_coeff12

double hiflow::_poly_x_lagrange_coeff12[]
static

Definition at line 210 of file lagrangecoeff12.cc.

◆ _poly_x_lagrange_coeff13

double hiflow::_poly_x_lagrange_coeff13[]
static

Definition at line 238 of file lagrangecoeff13.cc.

◆ _poly_x_lagrange_coeff14

double hiflow::_poly_x_lagrange_coeff14[]
static

Definition at line 268 of file lagrangecoeff14.cc.

◆ _poly_x_lagrange_coeff15

double hiflow::_poly_x_lagrange_coeff15[]
static

Definition at line 300 of file lagrangecoeff15.cc.

◆ _poly_x_lagrange_coeff16

double hiflow::_poly_x_lagrange_coeff16[]
static

Definition at line 334 of file lagrangecoeff16.cc.

◆ _poly_x_lagrange_coeff17

double hiflow::_poly_x_lagrange_coeff17[]
static

Definition at line 370 of file lagrangecoeff17.cc.

◆ _poly_x_lagrange_coeff18

double hiflow::_poly_x_lagrange_coeff18[]
static

Definition at line 408 of file lagrangecoeff18.cc.

◆ _poly_x_lagrange_coeff19

double hiflow::_poly_x_lagrange_coeff19[]
static

Definition at line 448 of file lagrangecoeff19.cc.

◆ _poly_x_lagrange_coeff2

double hiflow::_poly_x_lagrange_coeff2[]
static
Initial value:
= {
-3.000000000000000000000000000000e+00,
4.000000000000000000000000000000e+00,
0.000000000000000000000000000000e-01,
4.000000000000000000000000000000e+00,
-8.000000000000000000000000000000e+00,
0.000000000000000000000000000000e-01,
-1.000000000000000000000000000000e+00,
4.000000000000000000000000000000e+00,
0.000000000000000000000000000000e-01
}

Definition at line 40 of file lagrangecoeff2.cc.

◆ _poly_x_lagrange_coeff20

double hiflow::_poly_x_lagrange_coeff20[]
static

Definition at line 490 of file lagrangecoeff20.cc.

◆ _poly_x_lagrange_coeff3

double hiflow::_poly_x_lagrange_coeff3[]
static
Initial value:
= {
-5.500000000000000000000000000000e+00,
1.800000000000000000000000000000e+01,
-1.350000000000000000000000000000e+01,
0.000000000000000000000000000000e-01,
9.000000000000000000000000000000e+00,
-4.500000000000000000000000000000e+01,
4.050000000000000000000000000000e+01,
0.000000000000000000000000000000e-01,
-4.500000000000000000000000000000e+00,
3.600000000000000000000000000000e+01,
-4.050000000000000000000000000000e+01,
0.000000000000000000000000000000e-01,
1.000000000000000000000000000000e+00,
-9.000000000000000000000000000000e+00,
1.350000000000000000000000000000e+01,
0.000000000000000000000000000000e-01
}

Definition at line 48 of file lagrangecoeff3.cc.

◆ _poly_x_lagrange_coeff4

double hiflow::_poly_x_lagrange_coeff4[]
static

Definition at line 58 of file lagrangecoeff4.cc.

◆ _poly_x_lagrange_coeff5

double hiflow::_poly_x_lagrange_coeff5[]
static

Definition at line 71 of file lagrangecoeff5.cc.

◆ _poly_x_lagrange_coeff6

double hiflow::_poly_x_lagrange_coeff6[]
static

Definition at line 85 of file lagrangecoeff6.cc.

◆ _poly_x_lagrange_coeff7

double hiflow::_poly_x_lagrange_coeff7[]
static

Definition at line 101 of file lagrangecoeff7.cc.

◆ _poly_x_lagrange_coeff8

double hiflow::_poly_x_lagrange_coeff8[]
static

Definition at line 119 of file lagrangecoeff8.cc.

◆ _poly_x_lagrange_coeff9

double hiflow::_poly_x_lagrange_coeff9[]
static

Definition at line 138 of file lagrangecoeff9.cc.

◆ _poly_xx_lagrange_coeff1

double hiflow::_poly_xx_lagrange_coeff1[]
static
Initial value:
= {
0.000000000000000000000000000000e+00,
0.000000000000000000000000000000e+00,
0.000000000000000000000000000000e+00,
0.000000000000000000000000000000e+00
}

Definition at line 39 of file lagrangecoeff1.cc.

◆ _poly_xx_lagrange_coeff10

double hiflow::_poly_xx_lagrange_coeff10[]
static

Definition at line 297 of file lagrangecoeff10.cc.

◆ _poly_xx_lagrange_coeff11

double hiflow::_poly_xx_lagrange_coeff11[]
static

Definition at line 343 of file lagrangecoeff11.cc.

◆ _poly_xx_lagrange_coeff12

double hiflow::_poly_xx_lagrange_coeff12[]
static

Definition at line 394 of file lagrangecoeff12.cc.

◆ _poly_xx_lagrange_coeff13

double hiflow::_poly_xx_lagrange_coeff13[]
static

Definition at line 451 of file lagrangecoeff13.cc.

◆ _poly_xx_lagrange_coeff14

double hiflow::_poly_xx_lagrange_coeff14[]
static

Definition at line 511 of file lagrangecoeff14.cc.

◆ _poly_xx_lagrange_coeff15

double hiflow::_poly_xx_lagrange_coeff15[]
static

Definition at line 575 of file lagrangecoeff15.cc.

◆ _poly_xx_lagrange_coeff16

double hiflow::_poly_xx_lagrange_coeff16[]
static

Definition at line 643 of file lagrangecoeff16.cc.

◆ _poly_xx_lagrange_coeff17

double hiflow::_poly_xx_lagrange_coeff17[]
static

Definition at line 715 of file lagrangecoeff17.cc.

◆ _poly_xx_lagrange_coeff18

double hiflow::_poly_xx_lagrange_coeff18[]
static

Definition at line 791 of file lagrangecoeff18.cc.

◆ _poly_xx_lagrange_coeff19

double hiflow::_poly_xx_lagrange_coeff19[]
static

Definition at line 871 of file lagrangecoeff19.cc.

◆ _poly_xx_lagrange_coeff2

double hiflow::_poly_xx_lagrange_coeff2[]
static
Initial value:
= {
4.000000000000000000000000000000e+00,
0.000000000000000000000000000000e-01,
0.000000000000000000000000000000e-01,
-8.000000000000000000000000000000e+00,
0.000000000000000000000000000000e-01,
0.000000000000000000000000000000e-01,
4.000000000000000000000000000000e+00,
0.000000000000000000000000000000e-01,
0.000000000000000000000000000000e-01
}

Definition at line 55 of file lagrangecoeff2.cc.

◆ _poly_xx_lagrange_coeff20

double hiflow::_poly_xx_lagrange_coeff20[]
static

Definition at line 955 of file lagrangecoeff20.cc.

◆ _poly_xx_lagrange_coeff3

double hiflow::_poly_xx_lagrange_coeff3[]
static
Initial value:
= {
1.800000000000000000000000000000e+01,
-2.700000000000000000000000000000e+01,
0.000000000000000000000000000000e-01,
0.000000000000000000000000000000e-01,
-4.500000000000000000000000000000e+01,
8.100000000000000000000000000000e+01,
0.000000000000000000000000000000e-01,
0.000000000000000000000000000000e-01,
3.600000000000000000000000000000e+01,
-8.100000000000000000000000000000e+01,
0.000000000000000000000000000000e-01,
0.000000000000000000000000000000e-01,
-9.000000000000000000000000000000e+00,
2.700000000000000000000000000000e+01,
0.000000000000000000000000000000e-01,
0.000000000000000000000000000000e-01
}

Definition at line 71 of file lagrangecoeff3.cc.

◆ _poly_xx_lagrange_coeff4

double hiflow::_poly_xx_lagrange_coeff4[]
static

Definition at line 92 of file lagrangecoeff4.cc.

◆ _poly_xx_lagrange_coeff5

double hiflow::_poly_xx_lagrange_coeff5[]
static

Definition at line 117 of file lagrangecoeff5.cc.

◆ _poly_xx_lagrange_coeff6

double hiflow::_poly_xx_lagrange_coeff6[]
static

Definition at line 145 of file lagrangecoeff6.cc.

◆ _poly_xx_lagrange_coeff7

double hiflow::_poly_xx_lagrange_coeff7[]
static

Definition at line 177 of file lagrangecoeff7.cc.

◆ _poly_xx_lagrange_coeff8

double hiflow::_poly_xx_lagrange_coeff8[]
static

Definition at line 213 of file lagrangecoeff8.cc.

◆ _poly_xx_lagrange_coeff9

double hiflow::_poly_xx_lagrange_coeff9[]
static

Definition at line 252 of file lagrangecoeff9.cc.

◆ DEBUG_LEVEL

const int hiflow::DEBUG_LEVEL = 0

Definition at line 26 of file vector_space.cc.