Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Backofen, Rainer
amdis
Commits
dfe3c85e
Commit
dfe3c85e
authored
Jan 28, 2010
by
Thomas Witkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added more tests (in debug mode) for reading macros.
parent
f13f7769
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
AMDiS/src/MacroReader.cc
AMDiS/src/MacroReader.cc
+7
-11
AMDiS/src/Triangle.h
AMDiS/src/Triangle.h
+8
-0
No files found.
AMDiS/src/MacroReader.cc
View file @
dfe3c85e
...
@@ -40,7 +40,7 @@ namespace AMDiS {
...
@@ -40,7 +40,7 @@ namespace AMDiS {
// === read periodic data =================================
// === read periodic data =================================
if
(
periodicFile
&&
(
strcmp
(
periodicFile
,
""
)
!=
0
))
{
if
(
periodicFile
&&
(
strcmp
(
periodicFile
,
""
)
!=
0
))
{
WARNING
(
"
p
eriodic boundaries may lead to errors in small meshes if element neighbours not set
\n
"
);
WARNING
(
"
P
eriodic boundaries may lead to errors in small meshes if element neighbours
are
not set
!
\n
"
);
FILE
*
file
=
fopen
(
periodicFile
,
"r"
);
FILE
*
file
=
fopen
(
periodicFile
,
"r"
);
TEST_EXIT
(
file
)(
"can't open file %s
\n
"
,
periodicFile
);
TEST_EXIT
(
file
)(
"can't open file %s
\n
"
,
periodicFile
);
...
@@ -54,13 +54,11 @@ namespace AMDiS {
...
@@ -54,13 +54,11 @@ namespace AMDiS {
int
mode
=
-
1
;
// 0: drop dofs, 1: associate dofs
int
mode
=
-
1
;
// 0: drop dofs, 1: associate dofs
int
result
;
int
result
;
BoundaryType
boundaryType
;
BoundaryType
boundaryType
;
PeriodicMap
periodicMap
;
fscanf
(
file
,
"%*s %d"
,
&
n
);
fscanf
(
file
,
"%*s %d"
,
&
n
);
fscanf
(
file
,
"%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s"
);
fscanf
(
file
,
"%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s"
);
PeriodicMap
periodicMap
;
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
std
::
map
<
int
,
int
>
vertexMapEl1
;
std
::
map
<
int
,
int
>
vertexMapEl1
;
std
::
map
<
int
,
int
>
vertexMapEl2
;
std
::
map
<
int
,
int
>
vertexMapEl2
;
...
@@ -107,22 +105,23 @@ namespace AMDiS {
...
@@ -107,22 +105,23 @@ namespace AMDiS {
sideEl2
-=
verticesEl2
[
j
];
sideEl2
-=
verticesEl2
[
j
];
}
}
}
}
// create periodic info
// create periodic info
DimVec
<
WorldVector
<
double
>
>
periodicCoordsEl1
(
dim
-
1
,
NO_INIT
);
DimVec
<
WorldVector
<
double
>
>
periodicCoordsEl1
(
dim
-
1
,
NO_INIT
);
DimVec
<
WorldVector
<
double
>
>
periodicCoordsEl2
(
dim
-
1
,
NO_INIT
);
DimVec
<
WorldVector
<
double
>
>
periodicCoordsEl2
(
dim
-
1
,
NO_INIT
);
Element
*
element1
=
const_cast
<
Element
*>
((
*
(
mel
+
el1
))
->
getElement
());
Element
*
element1
=
const_cast
<
Element
*>
((
*
(
mel
+
el1
))
->
getElement
());
Element
*
element2
=
const_cast
<
Element
*>
((
*
(
mel
+
el2
))
->
getElement
());
Element
*
element2
=
const_cast
<
Element
*>
((
*
(
mel
+
el2
))
->
getElement
());
// for all vertices of this side
// for all vertices of this side
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
{
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
{
periodicCoordsEl1
[
element1
->
getPositionOfVertex
(
sideEl1
,
verticesEl1
[
j
])]
=
periodicCoordsEl1
[
element1
->
getPositionOfVertex
(
sideEl1
,
verticesEl1
[
j
])]
=
coords
[
melVertex
[
el2
][
vertexMapEl1
[
verticesEl1
[
j
]]]];
coords
[
melVertex
[
el2
][
vertexMapEl1
[
verticesEl1
[
j
]]]];
periodicCoordsEl2
[
element2
->
getPositionOfVertex
(
sideEl2
,
verticesEl2
[
j
])]
=
periodicCoordsEl2
[
element2
->
getPositionOfVertex
(
sideEl2
,
verticesEl2
[
j
])]
=
coords
[
melVertex
[
el1
][
vertexMapEl2
[
verticesEl2
[
j
]]]];
coords
[
melVertex
[
el1
][
vertexMapEl2
[
verticesEl2
[
j
]]]];
}
}
// decorate leaf data
// decorate leaf data
ElementData
*
ld1
=
element1
->
getElementData
();
ElementData
*
ld1
=
element1
->
getElementData
();
ElementData
*
ld2
=
element2
->
getElementData
();
ElementData
*
ld2
=
element2
->
getElementData
();
...
@@ -848,11 +847,8 @@ namespace AMDiS {
...
@@ -848,11 +847,8 @@ namespace AMDiS {
void
MacroInfo
::
fillBoundaryInfo
(
Mesh
*
mesh
)
void
MacroInfo
::
fillBoundaryInfo
(
Mesh
*
mesh
)
{
{
int
i
,
j
,
k
,
nv
=
mesh
->
getNumberOfVertices
();
int
i
,
j
,
k
,
nv
=
mesh
->
getNumberOfVertices
();
std
::
deque
<
MacroElement
*>::
iterator
melIt
;
std
::
deque
<
MacroElement
*>::
iterator
melIt
;
BoundaryType
*
bound
=
new
BoundaryType
[
nv
];
BoundaryType
*
bound
=
new
BoundaryType
[
nv
];
int
dim
=
mesh
->
getDim
();
int
dim
=
mesh
->
getDim
();
switch
(
dim
)
{
switch
(
dim
)
{
...
...
AMDiS/src/Triangle.h
View file @
dfe3c85e
...
@@ -126,6 +126,7 @@ namespace AMDiS {
...
@@ -126,6 +126,7 @@ namespace AMDiS {
FUNCNAME
(
"Triangle::getSideOfChild()"
);
FUNCNAME
(
"Triangle::getSideOfChild()"
);
TEST_EXIT_DBG
(
child
==
0
||
child
==
1
)(
"child must be in (0,1)
\n
"
);
TEST_EXIT_DBG
(
child
==
0
||
child
==
1
)(
"child must be in (0,1)
\n
"
);
TEST_EXIT_DBG
(
side
>=
0
&&
side
<=
2
)(
"side must be between 0 and 2
\n
"
);
TEST_EXIT_DBG
(
side
>=
0
&&
side
<=
2
)(
"side must be between 0 and 2
\n
"
);
return
sideOfChild
[
child
][
side
];
return
sideOfChild
[
child
][
side
];
}
}
...
@@ -135,19 +136,26 @@ namespace AMDiS {
...
@@ -135,19 +136,26 @@ namespace AMDiS {
FUNCNAME
(
"Triangle::getVertexOfParent()"
);
FUNCNAME
(
"Triangle::getVertexOfParent()"
);
TEST_EXIT_DBG
(
child
==
0
||
child
==
1
)(
"child must be in (0,1)
\n
"
);
TEST_EXIT_DBG
(
child
==
0
||
child
==
1
)(
"child must be in (0,1)
\n
"
);
TEST_EXIT_DBG
(
side
>=
0
&&
side
<=
2
)(
"side must be between 0 and 2
\n
"
);
TEST_EXIT_DBG
(
side
>=
0
&&
side
<=
2
)(
"side must be between 0 and 2
\n
"
);
return
vertexOfParent
[
child
][
side
];
return
vertexOfParent
[
child
][
side
];
}
}
virtual
int
getPositionOfVertex
(
int
side
,
int
vertex
)
const
virtual
int
getPositionOfVertex
(
int
side
,
int
vertex
)
const
{
{
FUNCNAME
(
"Triangle::getPositionOfVertex()"
);
TEST_EXIT_DBG
(
side
>=
0
&&
side
<=
2
)(
"Wrong side number %d!
\n
"
,
side
);
TEST_EXIT_DBG
(
vertex
>=
0
&&
vertex
<=
2
)(
"Wrong vertex number %d!
\n
"
,
vertex
);
static
int
positionOfVertex
[
3
][
3
]
=
{{
-
1
,
0
,
1
},
{
1
,
-
1
,
0
},
{
0
,
1
,
-
1
}};
static
int
positionOfVertex
[
3
][
3
]
=
{{
-
1
,
0
,
1
},
{
1
,
-
1
,
0
},
{
0
,
1
,
-
1
}};
return
positionOfVertex
[
side
][
vertex
];
return
positionOfVertex
[
side
][
vertex
];
}
}
inline
int
getEdgeOfFace
(
int
face
,
int
edge
)
const
inline
int
getEdgeOfFace
(
int
face
,
int
edge
)
const
{
{
FUNCNAME
(
"Triangle::getEdgeOfFace()"
);
TEST_EXIT_DBG
(
face
==
0
)(
"face must be zero at triangle
\n
"
);
TEST_EXIT_DBG
(
face
==
0
)(
"face must be zero at triangle
\n
"
);
TEST_EXIT_DBG
(
edge
>=
0
&&
edge
<
3
)(
"invalid edge
\n
"
);
TEST_EXIT_DBG
(
edge
>=
0
&&
edge
<
3
)(
"invalid edge
\n
"
);
return
edge
;
return
edge
;
}
}
...
...
Write
Preview
Markdown
is supported
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