ug4
field_util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015: G-CSC, Goethe University Frankfurt
3  * Author: Sebastian Reiter
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG_field_util
34 #define __H__UG_field_util
35 
36 #include "lib_grid/lg_base.h"
37 #include "common/util/field.h"
38 
39 namespace ug{
40 
42 void UG_API
43 CreateGridFromField(Grid& grid,
44  const Field<number>& field,
45  const vector2& cellSize,
46  const vector2& offset,
47  number noDataValue,
48  Grid::VertexAttachmentAccessor<APosition> aaPos);
49 
50 
52 void UG_API
54  const Field<number>& field,
55  const vector2& cellSize,
56  const vector2& offset,
57  number noDataValue,
58  Grid::VertexAttachmentAccessor<APosition> aaPos);
59 
60 
63 
64 template <class T>
65 void BlurField(Field<T>& field, number alpha, size_t numIterations, const T& noDataValue);
66 
67 
70 
72 template <class T>
73 bool EliminateInvalidCells(Field<T>& field, const T& noDataValue);
74 
75 
78 
82 template <class T>
83 void InvalidateSmallLenses(Field<T>& field, size_t thresholdCellCount,
84  const T& noDataValue);
85 
86 }// end of namespace
87 
89 // include implementation
90 #include "field_util_impl.h"
91 
92 #endif //__H__UG_field_util
number alpha
#define UG_API
Definition: ug_config.h:65
double number
Definition: types.h:124
MathVector< 2, number > vector2
a 2d vector
Definition: ugmath_types.h:69
the ug namespace
void BlurField(Field< T > &field, number alpha, size_t numIterations, const T &noDataValue)
Smoothens the field by adjusting the value of each pixel towards the average of its neighbours.
Definition: field_util_impl.h:43
bool EliminateInvalidCells(Field< T > &field, const T &noDataValue)
eliminates invalid cells by repeatedly filling those cells with averages of neighboring cells
Definition: field_util_impl.h:83
void InvalidateSmallLenses(Field< T > &field, size_t thresholdCellCount, const T &noDataValue)
invalidates cells that belong to a small lense
Definition: field_util_impl.h:222
void CreateGridFromField(Grid &grid, const Field< number > &field, const vector2 &cellSize, const vector2 &offset, number noDataValue, Grid::VertexAttachmentAccessor< APosition > aaPos)
Definition: field_util.cpp:41
void CreateGridFromFieldBoundary(Grid &grid, const Field< number > &field, const vector2 &cellSize, const vector2 &offset, number noDataValue, Grid::VertexAttachmentAccessor< APosition > aaPos)
Definition: field_util.cpp:117