Skip to content
GitLab
Menu
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
7c6dd8a4
Commit
7c6dd8a4
authored
Dec 09, 2011
by
Praetorius, Simon
Browse files
PngReader implemented
parent
74f06100
Changes
2
Show whitespace changes
Inline
Side-by-side
AMDiS/src/io/PngReader.cc
View file @
7c6dd8a4
...
...
@@ -29,23 +29,27 @@ namespace AMDiS {
png_infop
info_ptr
;
FILE
*
fp
;
unsigned
int
sig_read
=
0
;
int
row
,
col
,
nVertices
,
nElements
;
int
row
,
col
;
int
bytesPerPixel
=
0
;
// Open files and create the png data structures.
if
((
fp
=
fopen
(
filename
.
c_str
(),
"rb"
))
==
NULL
)
TEST_EXIT
(
0
)(
"ERROR: file can not be opened
\n
"
);
if
((
fp
=
fopen
(
filename
.
c_str
(),
"rb"
))
==
NULL
)
{
TEST_EXIT
(
0
)(
"ERROR: file can not >be opened
\n
"
);
}
png_ptr
=
png_create_read_struct
(
PNG_LIBPNG_VER_STRING
,
NULL
,
NULL
,
NULL
);
if
(
png_ptr
==
NULL
)
if
(
png_ptr
==
NULL
)
{
TEST_EXIT
(
0
)(
"ERROR in png_create_read_struct
\n
"
);
}
info_ptr
=
png_create_info_struct
(
png_ptr
);
if
(
info_ptr
==
NULL
)
if
(
info_ptr
==
NULL
)
{
TEST_EXIT
(
0
)(
"ERROR in png_create_info_struct
\n
"
);
}
if
(
setjmp
(
png_jmpbuf
(
png_ptr
)))
if
(
setjmp
(
png_jmpbuf
(
png_ptr
)))
{
TEST_EXIT
(
0
)(
"ERROR in png_jmpbuf
\n
"
);
}
png_init_io
(
png_ptr
,
fp
);
png_set_sig_bytes
(
png_ptr
,
sig_read
);
...
...
@@ -60,10 +64,6 @@ namespace AMDiS {
cout
<<
"Bytes per pixel: "
<<
bytesPerPixel
<<
endl
;
double
value
=
0
;
const
DOFAdmin
*
admin
=
vec
->
getFeSpace
()
->
getAdmin
();
int
n0
=
admin
->
getNumberOfPreDofs
(
VERTEX
);
//offset zum globale DOF-managment
int
dim
=
vec
->
getFeSpace
()
->
getMesh
()
->
getDim
();
int
dow
=
Global
::
getGeo
(
WORLD
);
const
BasisFunction
*
basFcts
=
vec
->
getFeSpace
()
->
getBasisFcts
();
int
numBasFcts
=
basFcts
->
getNumber
();
DegreeOfFreedom
*
localIndices
=
new
DegreeOfFreedom
[
numBasFcts
];
...
...
@@ -76,7 +76,6 @@ namespace AMDiS {
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_COORDS
);
while
(
elInfo
)
{
const
DegreeOfFreedom
**
dof
=
elInfo
->
getElement
()
->
getDof
();
Element
*
el
=
elInfo
->
getElement
();
basFcts
->
getLocalIndices
(
el
,
vec
->
getFeSpace
()
->
getAdmin
(),
localIndices
);
...
...
@@ -96,7 +95,7 @@ namespace AMDiS {
static_cast
<
double
>
(
info_ptr
->
row_pointers
[
row
][
col
*
3
+
2
]));
break
;
default:
TEST_EXIT
(
false
)(
"ERROR: bytesPerPixel=%d is unknown case!
\n
"
,
bytesPerPixel
)
TEST_EXIT
(
false
)(
"ERROR: bytesPerPixel=%d is unknown case!
\n
"
,
bytesPerPixel
)
;
}
(
*
vec
)[
localIndices
[
i
]]
=
value
;
}
...
...
@@ -107,7 +106,6 @@ namespace AMDiS {
png_destroy_read_struct
(
&
png_ptr
,
&
info_ptr
,
NULL
);
fclose
(
fp
);
};
return
(
0
);
}
}
};
AMDiS/src/io/PngReader.h
View file @
7c6dd8a4
...
...
@@ -20,8 +20,8 @@
/** \file ValueReader.h */
#ifndef AMDIS_
VALUE
READER_H
#define AMDIS_
VALUE
READER_H
#ifndef AMDIS_
PNG
READER_H
#define AMDIS_
PNG
READER_H
#include
"AMDiS.h"
...
...
@@ -63,6 +63,7 @@ namespace AMDiS {
yMin
=
minDim
[
1
];
yMax
=
maxDim
[
1
];
};
};
}
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment