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
d2f8df57
Commit
d2f8df57
authored
13 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
PngReader added to io
parent
9878746e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
AMDiS/src/io/PngReader.cc
+8
-3
8 additions, 3 deletions
AMDiS/src/io/PngReader.cc
AMDiS/src/io/PngReader.h
+25
-2
25 additions, 2 deletions
AMDiS/src/io/PngReader.h
with
33 additions
and
5 deletions
AMDiS/src/io/PngReader.cc
+
8
−
3
View file @
d2f8df57
...
@@ -17,7 +17,7 @@ namespace AMDiS {
...
@@ -17,7 +17,7 @@ namespace AMDiS {
/** \brief
/** \brief
* Copies the values of a value file to a DOF vector.
* Copies the values of a value file to a DOF vector.
*/
*/
void
PngReader
::
readValue
(
std
::
string
filename
,
void
PngReader
::
readValue
s
(
std
::
string
filename
,
DOFVector
<
double
>
*
vec
)
DOFVector
<
double
>
*
vec
)
{
{
FUNCNAME
(
"ValueReader::readValue()"
);
FUNCNAME
(
"ValueReader::readValue()"
);
...
@@ -67,6 +67,9 @@ namespace AMDiS {
...
@@ -67,6 +67,9 @@ namespace AMDiS {
const
BasisFunction
*
basFcts
=
vec
->
getFeSpace
()
->
getBasisFcts
();
const
BasisFunction
*
basFcts
=
vec
->
getFeSpace
()
->
getBasisFcts
();
int
numBasFcts
=
basFcts
->
getNumber
();
int
numBasFcts
=
basFcts
->
getNumber
();
DegreeOfFreedom
*
localIndices
=
new
DegreeOfFreedom
[
numBasFcts
];
DegreeOfFreedom
*
localIndices
=
new
DegreeOfFreedom
[
numBasFcts
];
double
xMin
=
0.0
,
xMax
=
1.0
,
yMin
=
0.0
,
yMax
=
1.0
;
getMeshDimension
(
vec
->
getFeSpace
()
->
getMesh
(),
xMin
,
xMax
,
yMin
,
yMax
);
TraverseStack
stack
;
TraverseStack
stack
;
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
vec
->
getFeSpace
()
->
getMesh
(),
-
1
,
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
vec
->
getFeSpace
()
->
getMesh
(),
-
1
,
...
@@ -78,8 +81,10 @@ namespace AMDiS {
...
@@ -78,8 +81,10 @@ namespace AMDiS {
basFcts
->
getLocalIndices
(
el
,
vec
->
getFeSpace
()
->
getAdmin
(),
localIndices
);
basFcts
->
getLocalIndices
(
el
,
vec
->
getFeSpace
()
->
getAdmin
(),
localIndices
);
for
(
int
i
=
0
;
i
<
numBasFcts
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numBasFcts
;
i
++
)
{
col
=
static_cast
<
int
>
(((
elInfo
->
getCoords
())[
i
][
0
])
*
(
info_ptr
->
width
-
1
));
double
lambdaX
=
((
elInfo
->
getCoords
())[
i
][
0
]
-
xMin
)
/
(
xMax
-
xMin
);
row
=
static_cast
<
int
>
((
1.0
-
(
elInfo
->
getCoords
())[
i
][
1
])
*
(
info_ptr
->
height
-
1
));
double
lambdaY
=
((
elInfo
->
getCoords
())[
i
][
1
]
-
yMin
)
/
(
yMax
-
yMin
);
col
=
static_cast
<
int
>
(
lambdaX
*
(
info_ptr
->
width
-
1
));
row
=
static_cast
<
int
>
((
1.0
-
lambdaY
)
*
(
info_ptr
->
height
-
1
));
switch
(
bytesPerPixel
)
{
switch
(
bytesPerPixel
)
{
case
1
:
case
1
:
value
=
static_cast
<
double
>
(
info_ptr
->
row_pointers
[
row
][
col
]);
value
=
static_cast
<
double
>
(
info_ptr
->
row_pointers
[
row
][
col
]);
...
...
This diff is collapsed.
Click to expand it.
AMDiS/src/io/PngReader.h
+
25
−
2
View file @
d2f8df57
...
@@ -36,9 +36,32 @@ namespace AMDiS {
...
@@ -36,9 +36,32 @@ namespace AMDiS {
{
{
public:
public:
/// Copies the values of a value file to a DOF vector.
/// Copies the values of a value file to a DOF vector.
static
void
readValue
(
std
::
string
filename
,
static
void
readValue
s
(
std
::
string
filename
,
DOFVector
<
double
>
*
dofVector
);
DOFVector
<
double
>
*
dofVector
);
};
private:
static
void
getMeshDimension
(
Mesh
*
mesh
,
double
&
xMin
,
double
&
xMax
,
double
&
yMin
,
double
&
yMax
)
{
WorldVector
<
double
>
minDim
;
minDim
.
set
(
1.e10
);
WorldVector
<
double
>
maxDim
;
maxDim
.
set
(
-
1.e10
);
TraverseStack
stack
;
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
0
,
Mesh
::
CALL_EL_LEVEL
|
Mesh
::
FILL_COORDS
);
while
(
elInfo
)
{
for
(
int
i
=
0
;
i
<=
mesh
->
getDim
();
i
++
)
{
WorldVector
<
double
>
&
coords
=
elInfo
->
getMacroElement
()
->
getCoord
(
i
);
for
(
int
j
=
0
;
j
<
coords
.
getSize
();
++
j
)
{
minDim
[
j
]
=
std
::
min
(
minDim
[
j
],
coords
[
j
]);
maxDim
[
j
]
=
std
::
max
(
maxDim
[
j
],
coords
[
j
]);
}
}
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
xMin
=
minDim
[
0
];
xMax
=
maxDim
[
0
];
yMin
=
minDim
[
1
];
yMax
=
maxDim
[
1
];
};
}
}
...
...
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