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
Snippets
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
iwr
amdis
Commits
6c8471f5
Commit
6c8471f5
authored
15 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
Branches containing commit
No related tags found
Tags containing commit
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 @@
...
@@ -24,10 +24,6 @@
namespace
AMDiS
{
namespace
AMDiS
{
// ==============================================================================
// ===== class BallProject ======================================================
// ==============================================================================
/** \brief
/** \brief
* Projects world coordinates to the surface of a ball with given center and
* Projects world coordinates to the surface of a ball with given center and
* radius. Can be used as boundary or volume projection.
* radius. Can be used as boundary or volume projection.
...
@@ -35,9 +31,7 @@ namespace AMDiS {
...
@@ -35,9 +31,7 @@ namespace AMDiS {
class
BallProject
:
public
Projection
class
BallProject
:
public
Projection
{
{
public:
public:
/** \brief
/// Constructor.
* Constructor.
*/
BallProject
(
int
id
,
BallProject
(
int
id
,
ProjectionType
type
,
ProjectionType
type
,
WorldVector
<
double
>
&
center
,
WorldVector
<
double
>
&
center
,
...
@@ -45,33 +39,25 @@ namespace AMDiS {
...
@@ -45,33 +39,25 @@ namespace AMDiS {
:
Projection
(
id
,
type
),
:
Projection
(
id
,
type
),
center_
(
center
),
center_
(
center
),
radius_
(
radius
)
radius_
(
radius
)
{}
;
{}
/** \brief
/// Destructor.
* Destructor.
virtual
~
BallProject
()
{}
*/
virtual
~
BallProject
()
{};
/** \brief
/// Implementation of Projection::project();
* Implementation of Projection::project();
*/
void
project
(
WorldVector
<
double
>
&
x
)
{
void
project
(
WorldVector
<
double
>
&
x
)
{
x
-=
center_
;
x
-=
center_
;
double
norm
=
sqrt
(
x
*
x
);
double
norm
=
sqrt
(
x
*
x
);
TEST_EXIT
(
norm
!=
0.0
)(
"can't project vector x
\n
"
);
TEST_EXIT
(
norm
!=
0.0
)(
"can't project vector x
\n
"
);
x
*=
radius_
/
norm
;
x
*=
radius_
/
norm
;
x
+=
center_
;
x
+=
center_
;
}
;
}
protected
:
protected
:
/** \brief
/// Center of the ball.
* Center of the ball.
*/
WorldVector
<
double
>
center_
;
WorldVector
<
double
>
center_
;
/** \brief
/// Radius of the ball.
* Radius of the ball.
*/
double
radius_
;
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 {
...
@@ -45,8 +45,9 @@ namespace AMDiS {
png_bytep
rowPointers
[
imageY
];
png_bytep
rowPointers
[
imageY
];
for
(
int
i
=
0
;
i
<
imageY
;
i
++
)
{
for
(
int
i
=
0
;
i
<
imageY
;
i
++
)
{
rowPointers
[
i
]
=
(
png_byte
*
)
png_malloc
(
png_ptr
,
// rowPointers[i] = (png_byte*)png_malloc(png_ptr,
(
imageType
==
0
?
imageX
:
imageX
*
3
));
// (imageType == 0 ? imageX : imageX * 3));
rowPointers
[
i
]
=
(
png_byte
*
)
malloc
(
sizeof
(
png_byte
)
*
imageX
*
3
);
}
}
const
BasisFunction
*
basisFcts
=
dataCollector
->
getFeSpace
()
->
getBasisFcts
();
const
BasisFunction
*
basisFcts
=
dataCollector
->
getFeSpace
()
->
getBasisFcts
();
...
@@ -67,16 +68,20 @@ namespace AMDiS {
...
@@ -67,16 +68,20 @@ namespace AMDiS {
rowPointers
[
indexY
][
indexX
]
=
rowPointers
[
indexY
][
indexX
]
=
static_cast
<
unsigned
char
>
((
*
dofvalues
)[
localDofs
[
i
]]);
static_cast
<
unsigned
char
>
((
*
dofvalues
)[
localDofs
[
i
]]);
}
else
{
}
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
);
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
]]);
int
value
=
static_cast
<
int
>
((
*
dofvalues
)[
localDofs
[
i
]]);
unsigned
char
r
=
value
%
256
;
unsigned
char
r
=
value
%
256
;
unsigned
char
g
=
(
value
-
r
%
(
256
*
256
))
/
256
;
unsigned
char
g
=
(
value
-
r
%
(
256
*
256
))
/
256
;
unsigned
char
b
=
(
value
-
r
-
g
)
/
(
256
*
256
);
unsigned
char
b
=
(
value
-
r
-
g
)
/
(
256
*
256
);
rowPointers
[
indexY
][
indexX
]
=
r
;
rowPointers
[
indexY
][
indexX
*
3
]
=
r
;
rowPointers
[
indexY
][
indexX
+
1
]
=
g
;
rowPointers
[
indexY
][
indexX
*
3
+
1
]
=
g
;
rowPointers
[
indexY
][
indexX
+
2
]
=
b
;
rowPointers
[
indexY
][
indexX
*
3
+
2
]
=
b
;
}
}
}
}
...
@@ -94,6 +99,10 @@ namespace AMDiS {
...
@@ -94,6 +99,10 @@ namespace AMDiS {
return
0
;
return
0
;
}
}
if
(
setjmp
(
png_jmpbuf
(
png_ptr
)))
{
return
0
;
}
png_init_io
(
png_ptr
,
fp
);
png_init_io
(
png_ptr
,
fp
);
png_set_IHDR
(
png_ptr
,
info_ptr
,
imageX
,
imageY
,
8
,
png_set_IHDR
(
png_ptr
,
info_ptr
,
imageX
,
imageY
,
8
,
...
@@ -104,7 +113,7 @@ namespace AMDiS {
...
@@ -104,7 +113,7 @@ namespace AMDiS {
png_set_rows
(
png_ptr
,
info_ptr
,
rowPointers
);
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
);
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 @@
...
@@ -27,18 +27,12 @@
namespace
AMDiS
{
namespace
AMDiS
{
/** \brief
/// Different possible types for a \ref Projection.
* Different possible types for a \ref Projection.
*/
enum
ProjectionType
{
enum
ProjectionType
{
BOUNDARY_PROJECTION
=
0
,
/**< Projection of boundary parts of an element. */
BOUNDARY_PROJECTION
=
0
,
/**< Projection of boundary parts of an element. */
VOLUME_PROJECTION
=
1
/**< Projection of whole elements. */
VOLUME_PROJECTION
=
1
/**< Projection of whole elements. */
};
};
// ==============================================================================
// ===== class Projection =======================================================
// ==============================================================================
/** \brief
/** \brief
* A Projection is a mapping from world coordinates to world coordinates.
* A Projection is a mapping from world coordinates to world coordinates.
* It must fullfill the condition \ref project(project(x)) == project(x).
* It must fullfill the condition \ref project(project(x)) == project(x).
...
@@ -49,9 +43,7 @@ namespace AMDiS {
...
@@ -49,9 +43,7 @@ namespace AMDiS {
class
Projection
class
Projection
{
{
public:
public:
/** \brief
/// Constructs a prjection with given id and type.
* Constructs a prjection with given id and type.
*/
Projection
(
int
id
,
ProjectionType
type
)
Projection
(
int
id
,
ProjectionType
type
)
:
projectionID_
(
id
),
:
projectionID_
(
id
),
projectionType_
(
type
)
projectionType_
(
type
)
...
@@ -65,47 +57,32 @@ namespace AMDiS {
...
@@ -65,47 +57,32 @@ namespace AMDiS {
virtual
~
Projection
()
{}
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
;
virtual
void
project
(
WorldVector
<
double
>&
x
)
=
0
;
/** \brief
/// Returns \ref projectionID.
* Returns \ref projectionID.
*/
inline
int
getID
()
{
inline
int
getID
()
{
return
projectionID_
;
return
projectionID_
;
}
}
/** \brief
/// Returns \ref projectionType;
* Returns \ref projectionType;
*/
inline
ProjectionType
getType
()
{
inline
ProjectionType
getType
()
{
return
projectionType_
;
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
)
{
static
Projection
*
getProjection
(
int
id
)
{
return
projectionMap_
[
id
];
return
projectionMap_
[
id
];
}
}
protected
:
protected
:
/** \brief
/// Unique projection id.
* Unique projection id.
*/
int
projectionID_
;
int
projectionID_
;
/** \brief
/// Type of this projection.
* Type of this projection.
*/
ProjectionType
projectionType_
;
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_
;
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 {
...
@@ -138,6 +138,8 @@ namespace AMDiS {
DOFVector
<
int
>::
Iterator
intPointIt
(
interpPointInd
,
USED_DOFS
);
DOFVector
<
int
>::
Iterator
intPointIt
(
interpPointInd
,
USED_DOFS
);
DOFVector
<
double
>::
Iterator
valueIt
(
values
,
USED_DOFS
);
DOFVector
<
double
>::
Iterator
valueIt
(
values
,
USED_DOFS
);
DOFVector
<
std
::
list
<
WorldVector
<
double
>
>
>::
Iterator
coordIt
(
dofCoords
,
USED_DOFS
);
DOFVector
<
std
::
list
<
WorldVector
<
double
>
>
>::
Iterator
coordIt
(
dofCoords
,
USED_DOFS
);
file
<<
std
::
fixed
;
// Write the values for all vertex DOFs.
// Write the values for all vertex DOFs.
for
(
intPointIt
.
reset
(),
valueIt
.
reset
(),
coordIt
.
reset
();
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