Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Backofen, Rainer
amdis
Commits
a9897bbf
Commit
a9897bbf
authored
Apr 15, 2009
by
Thomas Witkowski
Browse files
* And now, real code to write pngs!
parent
c8ee0e76
Changes
12
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/BasisFunction.h
View file @
a9897bbf
...
@@ -362,9 +362,7 @@ namespace AMDiS {
...
@@ -362,9 +362,7 @@ namespace AMDiS {
virtual
void
coarseRestr
(
DOFVector
<
WorldVector
<
double
>
>*
,
RCNeighbourList
*
,
int
)
virtual
void
coarseRestr
(
DOFVector
<
WorldVector
<
double
>
>*
,
RCNeighbourList
*
,
int
)
{}
{}
/** \brief
/// Returns local dof indices of the element for the given fe space.
* Returns local dof indices of the element for the given fe space.
*/
virtual
const
DegreeOfFreedom
*
getLocalIndices
(
const
Element
*
,
virtual
const
DegreeOfFreedom
*
getLocalIndices
(
const
Element
*
,
const
DOFAdmin
*
,
const
DOFAdmin
*
,
DegreeOfFreedom
*
)
const
DegreeOfFreedom
*
)
const
...
@@ -372,9 +370,7 @@ namespace AMDiS {
...
@@ -372,9 +370,7 @@ namespace AMDiS {
return
NULL
;
return
NULL
;
}
}
/** \brief
/// Returns local dof indices of the element for the given fe space.
* Returns local dof indices of the element for the given fe space.
*/
virtual
void
getLocalIndicesVec
(
const
Element
*
,
virtual
void
getLocalIndicesVec
(
const
Element
*
,
const
DOFAdmin
*
,
const
DOFAdmin
*
,
Vector
<
DegreeOfFreedom
>*
)
const
Vector
<
DegreeOfFreedom
>*
)
const
...
...
AMDiS/src/DOFMatrix.cc
View file @
a9897bbf
#include
"DOFMatrix.h"
#include
<algorithm>
#include
<algorithm>
#include
<png.h>
#include
<png.h>
#include
"DOFMatrix.h"
#include
"QPsiPhi.h"
#include
"QPsiPhi.h"
#include
"BasisFunction.h"
#include
"BasisFunction.h"
#include
"Boundary.h"
#include
"Boundary.h"
...
@@ -754,7 +755,8 @@ namespace AMDiS {
...
@@ -754,7 +755,8 @@ namespace AMDiS {
void
DOFMatrix
::
createPictureFile
(
const
char
*
filename
,
int
dim
)
void
DOFMatrix
::
createPictureFile
(
const
char
*
filename
,
int
dim
)
{
{
png_structp
png_ptr
=
png_create_write_struct
(
PNG_LIBPNG_VER_STRING
,
NULL
,
NULL
,
NULL
);
png_structp
png_ptr
=
png_create_write_struct
(
PNG_LIBPNG_VER_STRING
,
NULL
,
NULL
,
NULL
);
if
(
!
png_ptr
)
if
(
!
png_ptr
)
return
;
return
;
...
@@ -763,9 +765,8 @@ namespace AMDiS {
...
@@ -763,9 +765,8 @@ namespace AMDiS {
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
rowPointers
[
i
]
=
(
png_byte
*
)
png_malloc
(
png_ptr
,
dim
);
rowPointers
[
i
]
=
(
png_byte
*
)
png_malloc
(
png_ptr
,
dim
);
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
{
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
rowPointers
[
i
][
j
]
=
255
;
rowPointers
[
i
][
j
]
=
255
;
}
}
}
double
scalFactor
=
static_cast
<
double
>
(
dim
)
/
static_cast
<
double
>
(
matrix
.
size
());
double
scalFactor
=
static_cast
<
double
>
(
dim
)
/
static_cast
<
double
>
(
matrix
.
size
());
...
...
AMDiS/src/DataCollector.h
View file @
a9897bbf
...
@@ -42,17 +42,14 @@ namespace AMDiS {
...
@@ -42,17 +42,14 @@ namespace AMDiS {
* \ingroup Output
* \ingroup Output
*
*
* \brief
* \brief
* Provides data collecting of element, vertex and value data
* Provides data collecting of element, vertex and value data for file writer.
* for file writers.
*/
*/
class
DataCollector
class
DataCollector
{
{
public:
public:
MEMORY_MANAGED
(
DataCollector
);
MEMORY_MANAGED
(
DataCollector
);
/** \brief
/// Constructor
* Constructor.
*/
DataCollector
(
const
FiniteElemSpace
*
feSpace
,
DataCollector
(
const
FiniteElemSpace
*
feSpace
,
DOFVector
<
double
>
*
values
,
DOFVector
<
double
>
*
values
,
int
level
=
-
1
,
int
level
=
-
1
,
...
@@ -61,156 +58,96 @@ namespace AMDiS {
...
@@ -61,156 +58,96 @@ namespace AMDiS {
~
DataCollector
();
~
DataCollector
();
/** \brief
/// Fills the DataCollector with all possible datas.
* Fills the DataCollector with all possible datas.
*/
void
fillAllData
();
void
fillAllData
();
/** \brief
/// Returns list with element information.
* Returns list with element information.
*/
std
::
list
<
ElementInfo
>*
getElementInfos
();
std
::
list
<
ElementInfo
>*
getElementInfos
();
/** \brief
/// Returns vector with vertex information.
* Returns vector with vertex information.
*/
DOFVector
<
std
::
list
<
VertexInfo
>
>*
getVertexInfos
();
DOFVector
<
std
::
list
<
VertexInfo
>
>*
getVertexInfos
();
/** \brief
/// Returns the finite element space of the problem.
* Returns the finite element space of the problem.
*/
const
FiniteElemSpace
*
getFeSpace
();
const
FiniteElemSpace
*
getFeSpace
();
/** \brief
/// Returns vector with value information.
* Returns vector with value information.
*/
DOFVector
<
double
>*
getValues
();
DOFVector
<
double
>*
getValues
();
/** \brief
/// Returns vector with information about dof coordinates.
* Returns vector with information about dof coordinates.
*/
DOFVector
<
std
::
list
<
WorldVector
<
double
>
>
>*
getDofCoords
();
DOFVector
<
std
::
list
<
WorldVector
<
double
>
>
>*
getDofCoords
();
/** \brief
/// Returns vector with information about interpolation point indexing.
* Returns vector with information about interpolation
* point indexing.
*/
DOFVector
<
int
>*
getInterpPointInd
();
DOFVector
<
int
>*
getInterpPointInd
();
/** \brief
///
*
*/
DOFVector
<
std
::
list
<
WorldVector
<
double
>
>
>*
getInterpPointCoords
();
DOFVector
<
std
::
list
<
WorldVector
<
double
>
>
>*
getInterpPointCoords
();
/** \brief
/// Returns list of interpolation point information.
* Returns list of interpolation point information.
*/
std
::
vector
<
std
::
vector
<
int
>
>*
getInterpPoints
();
std
::
vector
<
std
::
vector
<
int
>
>*
getInterpPoints
();
/** \brief
/// Returns list of information about periodics.
* Returns list of information about periodics.
*/
std
::
list
<
PeriodicInfo
>*
getPeriodicInfos
();
std
::
list
<
PeriodicInfo
>*
getPeriodicInfos
();
/** \brief
/// Returns the number of vertices.
* Returns the number of vertices.
*/
int
getNumberVertices
();
int
getNumberVertices
();
/** \brief
/// Returns the number of elements.
* Returns the number of elements.
*/
int
getNumberElements
();
int
getNumberElements
();
/** \brief
/// Returns the number of interpolation points.
* Returns the number of interpolation points.
*/
int
getNumberInterpPoints
();
int
getNumberInterpPoints
();
/** \brief
// Returns the number of connections.
* Returns the number of connections.
*/
int
getNumberConnections
();
int
getNumberConnections
();
/** \brief
/// Returns the mesh of the problem.
* Returns the mesh of the problem.
*/
Mesh
*
getMesh
();
Mesh
*
getMesh
();
void
setMesh
(
Mesh
*
mesh
)
{
void
setMesh
(
Mesh
*
mesh
)
{
mesh_
=
mesh
;
mesh_
=
mesh
;
}
;
}
protected:
protected:
/** \brief
/// Start collecting element and vertex data of the problem.
* Start collecting element and vertex data of the problem.
*/
int
startCollectingElementData
();
int
startCollectingElementData
();
/** \brief
/// Start collecting value data of the problem.
* Start collecting value data of the problem.
*/
int
startCollectingValueData
();
int
startCollectingValueData
();
/** \brief
/// Start collecting periodic data of the problem.
* Start collecting periodic data of the problem.
*/
int
startCollectingPeriodicData
();
int
startCollectingPeriodicData
();
/** \brief
/// Adds information about one element and its vertices.
* Adds information about one element and its vertices.
*/
int
addElementData
(
ElInfo
*
elInfo
);
int
addElementData
(
ElInfo
*
elInfo
);
/** \brief
/// Adds value information of one element.
* Adds value information of one element.
*/
int
addValueData
(
ElInfo
*
elInfo
);
int
addValueData
(
ElInfo
*
elInfo
);
/** \brief
/// Adds information about interpolation points of vertices.
* Adds information about interpolation points of vertices.
*/
int
addInterpData
(
ElInfo
*
elInfo
);
int
addInterpData
(
ElInfo
*
elInfo
);
/** \brief
/// Adds value information of one element.
* Adds value information of one element.
*/
int
addPeriodicData
(
ElInfo
*
elInfo
);
int
addPeriodicData
(
ElInfo
*
elInfo
);
/// Vector with vertex values
/** \brief
* Vector with vertex values
*/
DOFVector
<
double
>
*
values_
;
DOFVector
<
double
>
*
values_
;
/** \brief
/// Level information for traversing the mesh.
* Level information for traversing the mesh.
*/
int
level_
;
int
level_
;
/** \brief
/// Flags for traversing the mesh.
* Flags for traversing the mesh.
*/
Flag
traverseFlag_
;
Flag
traverseFlag_
;
/** \brief
///
*
*/
const
FiniteElemSpace
*
feSpace_
;
const
FiniteElemSpace
*
feSpace_
;
/** \brief
/// Mesh that should be written
* Mesh that should be written
*/
Mesh
*
mesh_
;
Mesh
*
mesh_
;
/** \brief
/// DOFAdmin of values
* DOFAdmin of values
*/
DOFAdmin
*
localAdmin_
;
DOFAdmin
*
localAdmin_
;
/** \brief
/// vertex pre-dofs
* vertex pre-dofs
*/
int
nPreDofs_
;
int
nPreDofs_
;
/// Number of vertices.
/// Number of vertices.
...
...
AMDiS/src/ElInfo.h
View file @
a9897bbf
...
@@ -101,57 +101,42 @@ namespace AMDiS {
...
@@ -101,57 +101,42 @@ namespace AMDiS {
return
*
this
;
return
*
this
;
}
}
// ===== getting-methods ======================================================
public:
public:
/** \name getting methods
/** \name getting methods
* \{
* \{
*/
*/
/** \brief
/// Get ElInfo's \ref mesh_
* Get ElInfo's \ref mesh_
*/
inline
Mesh
*
getMesh
()
const
{
inline
Mesh
*
getMesh
()
const
{
return
mesh_
;
return
mesh_
;
}
}
/** \brief
/// Get ElInfo's \ref macroElement_
* Get ElInfo's \ref macroElement_
*/
inline
MacroElement
*
getMacroElement
()
const
{
inline
MacroElement
*
getMacroElement
()
const
{
return
macroElement_
;
return
macroElement_
;
}
}
/** \brief
/// Get ElInfo's \ref element
* Get ElInfo's \ref element
*/
inline
Element
*
getElement
()
const
{
inline
Element
*
getElement
()
const
{
return
element_
;
return
element_
;
}
}
/** \brief
/// Get ElInfo's \ref parent_
* Get ElInfo's \ref parent_
*/
inline
Element
*
getParent
()
const
{
inline
Element
*
getParent
()
const
{
return
parent_
;
return
parent_
;
}
}
/** \brief
/// Get ElInfo's \ref fillFlag_
* Get ElInfo's \ref fillFlag_
*/
inline
Flag
getFillFlag
()
const
{
inline
Flag
getFillFlag
()
const
{
return
fillFlag_
;
return
fillFlag_
;
}
}
/** \brief
/// Get ElInfo's \ref level
* Get ElInfo's \ref level
*/
inline
int
getLevel
()
const
{
inline
int
getLevel
()
const
{
return
level
;
return
level
;
}
}
/** \brief
/// Get ElInfo's \ref iChild
* Get ElInfo's \ref iChild
*/
inline
int
getIChild
()
const
{
inline
int
getIChild
()
const
{
return
iChild
;
return
iChild
;
}
}
...
@@ -188,12 +173,10 @@ namespace AMDiS {
...
@@ -188,12 +173,10 @@ namespace AMDiS {
return
coord_
;
return
coord_
;
}
}
/** \brief
/// Get ElInfo's \ref oppCoord_[i]
* Get ElInfo's \ref oppCoord_[i]
*/
inline
WorldVector
<
double
>&
getOppCoord
(
int
i
)
{
inline
WorldVector
<
double
>&
getOppCoord
(
int
i
)
{
return
oppCoord_
[
i
];
return
oppCoord_
[
i
];
}
;
}
/** \brief
/** \brief
* Get ElInfo's \ref boundary_[i]
* Get ElInfo's \ref boundary_[i]
...
@@ -466,20 +449,13 @@ namespace AMDiS {
...
@@ -466,20 +449,13 @@ namespace AMDiS {
int
iChild
)
const
=
0
;
int
iChild
)
const
=
0
;
protected:
protected:
/// Pointer to the current mesh
/** \brief
* Pointer to the current mesh
*/
Mesh
*
mesh_
;
Mesh
*
mesh_
;
/** \brief
/// Pointer to the current element
* Pointer to the current element
*/
Element
*
element_
;
Element
*
element_
;
/** \brief
/// \ref element is child of element parent_
* \ref element is child of element parent_
*/
Element
*
parent_
;
Element
*
parent_
;
/** \brief
/** \brief
...
...
AMDiS/src/ElementMatrix.h
View file @
a9897bbf
...
@@ -27,10 +27,6 @@
...
@@ -27,10 +27,6 @@
namespace
AMDiS
{
namespace
AMDiS
{
// =============================================================================
// ===== class ElementMatrix ===================================================
// =============================================================================
/** \ingroup Assembler
/** \ingroup Assembler
*
*
* \brief
* \brief
...
@@ -42,24 +38,18 @@ namespace AMDiS {
...
@@ -42,24 +38,18 @@ namespace AMDiS {
public:
public:
MEMORY_MANAGED
(
ElementMatrix
);
MEMORY_MANAGED
(
ElementMatrix
);
/** \brief
/// Constructor
* Constructor.
*/
ElementMatrix
(
int
numRows
,
int
numCols
)
ElementMatrix
(
int
numRows
,
int
numCols
)
:
Matrix
<
double
>
(
numRows
,
numCols
),
:
Matrix
<
double
>
(
numRows
,
numCols
),
rowIndices
(
numRows
),
rowIndices
(
numRows
),
colIndices
(
numCols
)
colIndices
(
numCols
)
{}
;
{}
public:
public:
/** \brief
/// Row dof indices.
* row dof indices.
*/
Vector
<
DegreeOfFreedom
>
rowIndices
;
Vector
<
DegreeOfFreedom
>
rowIndices
;
/** \brief
/// Column dof indices.
* column dof indices.
*/
Vector
<
DegreeOfFreedom
>
colIndices
;
Vector
<
DegreeOfFreedom
>
colIndices
;
};
};
...
...
AMDiS/src/FileWriter.cc
View file @
a9897bbf
...
@@ -108,6 +108,7 @@ namespace AMDiS {
...
@@ -108,6 +108,7 @@ namespace AMDiS {
writeParaViewAnimation
=
0
;
writeParaViewAnimation
=
0
;
writePeriodicFormat
=
0
;
writePeriodicFormat
=
0
;
writePngFormat
=
0
;
writePngFormat
=
0
;
pngType
=
0
;
appendIndex
=
0
;
appendIndex
=
0
;
indexLength
=
5
;
indexLength
=
5
;
indexDecimals
=
3
;
indexDecimals
=
3
;
...
@@ -135,6 +136,7 @@ namespace AMDiS {
...
@@ -135,6 +136,7 @@ namespace AMDiS {
GET_PARAMETER
(
0
,
name
+
"->Periodic format"
,
"%d"
,
&
writePeriodicFormat
);
GET_PARAMETER
(
0
,
name
+
"->Periodic format"
,
"%d"
,
&
writePeriodicFormat
);
GET_PARAMETER
(
0
,
name
+
"->Periodic ext"
,
&
periodicFileExt
);
GET_PARAMETER
(
0
,
name
+
"->Periodic ext"
,
&
periodicFileExt
);
GET_PARAMETER
(
0
,
name
+
"->PNG format"
,
"%d"
,
&
writePngFormat
);
GET_PARAMETER
(
0
,
name
+
"->PNG format"
,
"%d"
,
&
writePngFormat
);
GET_PARAMETER
(
0
,
name
+
"->PNG type"
,
"%d"
,
&
pngType
);
GET_PARAMETER
(
0
,
name
+
"->append index"
,
"%d"
,
&
appendIndex
);
GET_PARAMETER
(
0
,
name
+
"->append index"
,
"%d"
,
&
appendIndex
);
GET_PARAMETER
(
0
,
name
+
"->index length"
,
"%d"
,
&
indexLength
);
GET_PARAMETER
(
0
,
name
+
"->index length"
,
"%d"
,
&
indexLength
);
GET_PARAMETER
(
0
,
name
+
"->index decimals"
,
"%d"
,
&
indexDecimals
);
GET_PARAMETER
(
0
,
name
+
"->index decimals"
,
"%d"
,
&
indexDecimals
);
...
@@ -233,14 +235,14 @@ namespace AMDiS {
...
@@ -233,14 +235,14 @@ namespace AMDiS {
VtkWriter
vtkWriter
(
&
dataCollectors
);
VtkWriter
vtkWriter
(
&
dataCollectors
);
vtkWriter
.
updateAnimationFile
(
fn
+
paraViewFileExt
,
vtkWriter
.
updateAnimationFile
(
fn
+
paraViewFileExt
,
&
paraViewAnimationFrames_
,
&
paraViewAnimationFrames_
,
const_cast
<
char
*>
((
filename
+
".pvd"
)
.
c_str
()))
;
filename
+
".pvd"
);
}
}
if
(
writePngFormat
)
{
if
(
writePngFormat
)
{
PngWriter
pngWriter
(
dataCollectors
[
0
]);
PngWriter
pngWriter
(
dataCollectors
[
0
]);
pngWriter
.
writeFile
(
const_cast
<
char
*>
((
fn
+
paraViewFileExt
).
c_str
())
);
pngWriter
.
writeFile
(
fn
+
".png"
,
pngType
);
MSG
(
"PNG image file written to %s
\n
"
,
(
fn
+
paraViewFileExt
).
c_str
());
MSG
(
"PNG image file written to %s
\n
"
,
(
fn
+
".png"
).
c_str
());
}
}
...
...
AMDiS/src/FileWriter.h
View file @
a9897bbf
...
@@ -184,6 +184,9 @@ namespace AMDiS {
...
@@ -184,6 +184,9 @@ namespace AMDiS {
/// 0: Don't write png files; 1: Write png image files.
/// 0: Don't write png files; 1: Write png image files.
int
writePngFormat
;
int
writePngFormat
;
/// 0: Gray color picture; 1: RGB picture.
int
pngType
;
/** \brief
/** \brief
* 0: Don't append time index to filename prefix.
* 0: Don't append time index to filename prefix.
* 1: Append time index to filename prefix.
* 1: Append time index to filename prefix.
...
...
AMDiS/src/FiniteElemSpace.h
View file @
a9897bbf
...
@@ -32,10 +32,6 @@
...
@@ -32,10 +32,6 @@
namespace
AMDiS
{
namespace
AMDiS
{
// ============================================================================
// ===== forward declarations =================================================
// ============================================================================
class
DOFAdmin
;
class
DOFAdmin
;
class
BasisFunction
;
class
BasisFunction
;
class
Mesh
;
class
Mesh
;
...
@@ -43,29 +39,19 @@ namespace AMDiS {
...
@@ -43,29 +39,19 @@ namespace AMDiS {
template
<
typename
T
>
class
DOFVector
;
template
<
typename
T
>
class
DOFVector
;
template
<
typename
T
>
class
DimVec
;
template
<
typename
T
>
class
DimVec
;
// ============================================================================
// ===== class FiniteElemSpace ================================================
// ============================================================================
/** \ingroup FEMSpace
/** \ingroup FEMSpace