Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Backofen, Rainer
amdis
Commits
6c8471f5
Commit
6c8471f5
authored
16 years ago
by
Thomas Witkowski
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a bug when writing long value numbers in vtk output
parent
039fe100
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
AMDiS/src/BallProject.h
+9
-23
9 additions, 23 deletions
AMDiS/src/BallProject.h
AMDiS/src/PngWriter.cc
+16
-7
16 additions, 7 deletions
AMDiS/src/PngWriter.cc
AMDiS/src/Projection.h
+10
-33
10 additions, 33 deletions
AMDiS/src/Projection.h
AMDiS/src/VtkWriter.hh
+2
-0
2 additions, 0 deletions
AMDiS/src/VtkWriter.hh
with
37 additions
and
63 deletions
AMDiS/src/BallProject.h
+
9
−
23
View file @
6c8471f5
...
...
@@ -24,10 +24,6 @@
namespace
AMDiS
{
// ==============================================================================
// ===== class BallProject ======================================================
// ==============================================================================
/** \brief
* Projects world coordinates to the surface of a ball with given center and
* radius. Can be used as boundary or volume projection.
...
...
@@ -35,9 +31,7 @@ namespace AMDiS {
class
BallProject
:
public
Projection
{
public:
/** \brief
* Constructor.
*/
/// Constructor.
BallProject
(
int
id
,
ProjectionType
type
,
WorldVector
<
double
>
&
center
,
...
...
@@ -45,33 +39,25 @@ namespace AMDiS {
:
Projection
(
id
,
type
),
center_
(
center
),
radius_
(
radius
)
{}
;
{}
/** \brief
* Destructor.
*/
virtual
~
BallProject
()
{};
/// Destructor.
virtual
~
BallProject
()
{}
/** \brief
* Implementation of Projection::project();
*/
/// Implementation of Projection::project();
void
project
(
WorldVector
<
double
>
&
x
)
{
x
-=
center_
;
double
norm
=
sqrt
(
x
*
x
);
TEST_EXIT
(
norm
!=
0.0
)(
"can't project vector x
\n
"
);
x
*=
radius_
/
norm
;
x
*=
radius_
/
norm
;
x
+=
center_
;
}
;
}
protected
:
/** \brief
* Center of the ball.
*/
/// Center of the ball.
WorldVector
<
double
>
center_
;
/** \brief
* Radius of the ball.
*/
/// Radius of the ball.
double
radius_
;
};
...
...
This diff is collapsed.
Click to expand it.
AMDiS/src/PngWriter.cc
+
16
−
7
View file @
6c8471f5
...
...
@@ -45,8 +45,9 @@ namespace AMDiS {
png_bytep
rowPointers
[
imageY
];
for
(
int
i
=
0
;
i
<
imageY
;
i
++
)
{
rowPointers
[
i
]
=
(
png_byte
*
)
png_malloc
(
png_ptr
,
(
imageType
==
0
?
imageX
:
imageX
*
3
));
// rowPointers[i] = (png_byte*)png_malloc(png_ptr,
// (imageType == 0 ? imageX : imageX * 3));
rowPointers
[
i
]
=
(
png_byte
*
)
malloc
(
sizeof
(
png_byte
)
*
imageX
*
3
);
}
const
BasisFunction
*
basisFcts
=
dataCollector
->
getFeSpace
()
->
getBasisFcts
();
...
...
@@ -67,16 +68,20 @@ namespace AMDiS {
rowPointers
[
indexY
][
indexX
]
=
static_cast
<
unsigned
char
>
((
*
dofvalues
)[
localDofs
[
i
]]);
}
else
{
int
indexX
=
static_cast
<
int
>
((
elInfo
->
getCoord
(
i
))[
0
]
/
pointdist
)
*
3
;
int
indexX
=
static_cast
<
int
>
((
elInfo
->
getCoord
(
i
))[
0
]
/
pointdist
);
int
indexY
=
static_cast
<
int
>
((
elInfo
->
getCoord
(
i
))[
1
]
/
pointdist
);
TEST_EXIT
(
indexX
>=
0
&&
indexX
<
imageX
)(
"X-index out of range!"
);
TEST_EXIT
(
indexY
>=
0
&&
indexY
<
imageY
)(
"Y-index out of range!"
);
int
value
=
static_cast
<
int
>
((
*
dofvalues
)[
localDofs
[
i
]]);
unsigned
char
r
=
value
%
256
;
unsigned
char
g
=
(
value
-
r
%
(
256
*
256
))
/
256
;
unsigned
char
b
=
(
value
-
r
-
g
)
/
(
256
*
256
);
rowPointers
[
indexY
][
indexX
]
=
r
;
rowPointers
[
indexY
][
indexX
+
1
]
=
g
;
rowPointers
[
indexY
][
indexX
+
2
]
=
b
;
rowPointers
[
indexY
][
indexX
*
3
]
=
r
;
rowPointers
[
indexY
][
indexX
*
3
+
1
]
=
g
;
rowPointers
[
indexY
][
indexX
*
3
+
2
]
=
b
;
}
}
...
...
@@ -94,6 +99,10 @@ namespace AMDiS {
return
0
;
}
if
(
setjmp
(
png_jmpbuf
(
png_ptr
)))
{
return
0
;
}
png_init_io
(
png_ptr
,
fp
);
png_set_IHDR
(
png_ptr
,
info_ptr
,
imageX
,
imageY
,
8
,
...
...
@@ -104,7 +113,7 @@ namespace AMDiS {
png_set_rows
(
png_ptr
,
info_ptr
,
rowPointers
);
png_write_png
(
png_ptr
,
info_ptr
,
PNG_TRANSFORM_IDENTITY
,
NULL
);
png_write_png
(
png_ptr
,
info_ptr
,
PNG_TRANSFORM_IDENTITY
,
png_voidp_
NULL
);
png_destroy_write_struct
(
&
png_ptr
,
&
info_ptr
);
...
...
This diff is collapsed.
Click to expand it.
AMDiS/src/Projection.h
+
10
−
33
View file @
6c8471f5
...
...
@@ -27,18 +27,12 @@
namespace
AMDiS
{
/** \brief
* Different possible types for a \ref Projection.
*/
/// Different possible types for a \ref Projection.
enum
ProjectionType
{
BOUNDARY_PROJECTION
=
0
,
/**< Projection of boundary parts of an element. */
VOLUME_PROJECTION
=
1
/**< Projection of whole elements. */
};
// ==============================================================================
// ===== class Projection =======================================================
// ==============================================================================
/** \brief
* A Projection is a mapping from world coordinates to world coordinates.
* It must fullfill the condition \ref project(project(x)) == project(x).
...
...
@@ -49,9 +43,7 @@ namespace AMDiS {
class
Projection
{
public:
/** \brief
* Constructs a prjection with given id and type.
*/
/// Constructs a prjection with given id and type.
Projection
(
int
id
,
ProjectionType
type
)
:
projectionID_
(
id
),
projectionType_
(
type
)
...
...
@@ -65,47 +57,32 @@ namespace AMDiS {
virtual
~
Projection
()
{}
/** \brief
* Projection method. Must be overriden in sub classes.
*/
/// Projection method. Must be overriden in sub classes.
virtual
void
project
(
WorldVector
<
double
>&
x
)
=
0
;
/** \brief
* Returns \ref projectionID.
*/
/// Returns \ref projectionID.
inline
int
getID
()
{
return
projectionID_
;
}
/** \brief
* Returns \ref projectionType;
*/
/// Returns \ref projectionType;
inline
ProjectionType
getType
()
{
return
projectionType_
;
}
/** \brief
* Returns the projection with the given id, if existing.
* Returns NULL otherwise.
*/
/// Returns the projection with the given id, if existing. Returns NULL otherwise.
static
Projection
*
getProjection
(
int
id
)
{
return
projectionMap_
[
id
];
}
protected
:
/** \brief
* Unique projection id.
*/
/// Unique projection id.
int
projectionID_
;
/** \brief
* Type of this projection.
*/
/// Type of this projection.
ProjectionType
projectionType_
;
/** \brief
* Static mapping from ids to projection objects. Used in \ref getProjection().
*/
/// Static mapping from ids to projection objects. Used in \ref getProjection().
static
std
::
map
<
int
,
Projection
*>
projectionMap_
;
};
...
...
This diff is collapsed.
Click to expand it.
AMDiS/src/VtkWriter.hh
+
2
−
0
View file @
6c8471f5
...
...
@@ -138,6 +138,8 @@ namespace AMDiS {
DOFVector
<
int
>::
Iterator
intPointIt
(
interpPointInd
,
USED_DOFS
);
DOFVector
<
double
>::
Iterator
valueIt
(
values
,
USED_DOFS
);
DOFVector
<
std
::
list
<
WorldVector
<
double
>
>
>::
Iterator
coordIt
(
dofCoords
,
USED_DOFS
);
file
<<
std
::
fixed
;
// Write the values for all vertex DOFs.
for
(
intPointIt
.
reset
(),
valueIt
.
reset
(),
coordIt
.
reset
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment