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
d5d0ec5a
Commit
d5d0ec5a
authored
Jun 09, 2009
by
Thomas Witkowski
Browse files
Work in progress on parallel domain decomposition.
parent
be06847b
Changes
3
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/DOFAdmin.h
View file @
d5d0ec5a
...
...
@@ -75,7 +75,8 @@ namespace AMDiS {
bool
operator
==
(
const
DOFAdmin
&
)
const
;
/// Compares two DOFAdmins by their names.
inline
bool
operator
!=
(
const
DOFAdmin
&
ad
)
const
{
inline
bool
operator
!=
(
const
DOFAdmin
&
ad
)
const
{
return
!
(
ad
==*
this
);
}
...
...
@@ -104,12 +105,14 @@ namespace AMDiS {
void
compress
(
std
::
vector
<
DegreeOfFreedom
>
&
new_dof
);
/// Returns an iterator to the begin of \ref dofIndexedList
std
::
list
<
DOFIndexedBase
*>::
iterator
beginDOFIndexed
()
{
std
::
list
<
DOFIndexedBase
*>::
iterator
beginDOFIndexed
()
{
return
dofIndexedList
.
begin
();
}
/// Returns an iterator to the end of \ref dofIndexedList
std
::
list
<
DOFIndexedBase
*>::
iterator
endDOFIndexed
()
{
std
::
list
<
DOFIndexedBase
*>::
iterator
endDOFIndexed
()
{
return
dofIndexedList
.
end
();
}
...
...
@@ -118,47 +121,56 @@ namespace AMDiS {
*/
/// Returns \ref sizeUsed.
inline
const
int
getUsedSize
()
const
{
inline
const
int
getUsedSize
()
const
{
return
sizeUsed
;
}
/// Returns \ref size
inline
const
int
getSize
()
const
{
inline
const
int
getSize
()
const
{
return
size
;
}
/// Returns \ref usedCount
inline
const
int
getUsedDOFs
()
const
{
inline
const
int
getUsedDOFs
()
const
{
return
usedCount
;
}
/// Returns \ref holeCount
inline
const
int
getHoleCount
()
const
{
inline
const
int
getHoleCount
()
const
{
return
holeCount
;
}
/// Returns \ref name
inline
const
std
::
string
&
getName
()
const
{
inline
const
std
::
string
&
getName
()
const
{
return
name
;
}
/// Returns \ref nrDOF[i], i.e., the number of dofs for the position i.
inline
const
int
getNumberOfDOFs
(
int
i
)
const
{
inline
const
int
getNumberOfDOFs
(
int
i
)
const
{
return
nrDOF
[
i
];
}
/// Returns \ref nrDOF
inline
const
DimVec
<
int
>&
getNumberOfDOFs
()
const
{
inline
const
DimVec
<
int
>&
getNumberOfDOFs
()
const
{
return
nrDOF
;
}
/// Returns \ref nr0DOF[i]
inline
const
int
getNumberOfPreDOFs
(
int
i
)
const
{
inline
const
int
getNumberOfPreDOFs
(
int
i
)
const
{
return
nr0DOF
[
i
];
}
/// Returns \ref nr0DOF
inline
const
DimVec
<
int
>&
getNumberOfPreDOFs
()
const
{
inline
const
DimVec
<
int
>&
getNumberOfPreDOFs
()
const
{
return
nr0DOF
;
}
...
...
@@ -168,12 +180,14 @@ namespace AMDiS {
}
/// Returns \ref dofFree, the array denoting DOFs to be either free or used.
inline
const
std
::
vector
<
bool
>&
getDOFFree
()
const
{
inline
const
std
::
vector
<
bool
>&
getDOFFree
()
const
{
return
dofFree
;
}
/// Returns if the given DOF is free.
inline
const
bool
isDOFFree
(
int
i
)
const
{
inline
const
bool
isDOFFree
(
int
i
)
const
{
return
dofFree
[
i
];
}
...
...
@@ -190,12 +204,14 @@ namespace AMDiS {
void
setNumberOfPreDOFs
(
int
i
,
int
v
);
/// Sets \ref name = n
inline
void
setName
(
const
std
::
string
&
n
)
{
inline
void
setName
(
const
std
::
string
&
n
)
{
name
=
n
;
}
/// Sets \ref mesh = m
inline
void
setMesh
(
Mesh
*
m
)
{
inline
void
setMesh
(
Mesh
*
m
)
{
mesh
=
m
;
}
...
...
AMDiS/src/DOFIterator.h
View file @
d5d0ec5a
...
...
@@ -69,7 +69,8 @@ namespace AMDiS {
* Sub classes must
* implement goToBeginOfIteratedObject() which resets the iterator.
*/
virtual
void
reset
()
{
virtual
void
reset
()
{
position
=
0
;
dofFreeIterator
=
dofFree
->
begin
();
if
(
dofFreeIterator
==
dofFree
->
end
())
...
...
@@ -86,15 +87,16 @@ namespace AMDiS {
* Sub classes must
* implement goToBeginOfIteratedObject() which resets the iterator.
*/
virtual
void
reset2
()
{
virtual
void
reset2
()
{
position
=
0
;
dofFreeIterator
=
dofFree
->
begin
();
if
(
dofFreeIterator
==
dofFree
->
end
())
{
if
(
dofFreeIterator
==
dofFree
->
end
())
{
return
;
}
goToBeginOfIteratedObject
();
if
(
type
!=
ALL_DOFS
)
{
if
(
*
dofFreeIterator
==
(
type
==
USED_DOFS
))
if
(
type
!=
ALL_DOFS
)
{
if
(
*
dofFreeIterator
==
(
type
==
USED_DOFS
))
operator
++
();
}
}
...
...
@@ -108,7 +110,8 @@ namespace AMDiS {
* must implement incObjectIterator() which increments the object
* iterator.
*/
inline
const
DOFIteratorBase
&
operator
++
()
{
inline
const
DOFIteratorBase
&
operator
++
()
{
if
(
type
==
ALL_DOFS
)
{
incObjectIterator
();
dofFreeIterator
++
;
...
...
@@ -136,13 +139,15 @@ namespace AMDiS {
}
/// Postfix operator++.
inline
DOFIteratorBase
operator
++
(
int
)
{
inline
DOFIteratorBase
operator
++
(
int
)
{
DOFIteratorBase
clone
=
*
this
;
operator
++
();
return
clone
;
}
inline
const
DOFIteratorBase
&
operator
--
()
{
inline
const
DOFIteratorBase
&
operator
--
()
{
if
(
type
==
ALL_DOFS
)
{
decObjectIterator
();
dofFreeIterator
--
;
...
...
@@ -160,14 +165,16 @@ namespace AMDiS {
return
*
this
;
}
inline
DOFIteratorBase
operator
--
(
int
)
{
inline
DOFIteratorBase
operator
--
(
int
)
{
DOFIteratorBase
clone
=
*
this
;
operator
--
();
return
clone
;
}
/// Dereferntiation of the \ref dofFreeIterator
virtual
bool
isDOFFree
()
{
virtual
bool
isDOFFree
()
{
return
*
dofFreeIterator
;
}
...
...
@@ -175,12 +182,21 @@ namespace AMDiS {
* Returns whether \ref dofFreeIterator already has reached the end of
* \ref dofFree
*/
inline
bool
end
()
{
return
(
dofFreeIterator
==
dofFree
->
end
());
}
inline
bool
end
()
{
return
(
dofFreeIterator
==
dofFree
->
end
());
}
inline
bool
begin
()
{
return
(
dofFreeIterator
==
dofFree
->
begin
());
}
inline
bool
begin
()
{
return
(
dofFreeIterator
==
dofFree
->
begin
());
}
/// Returns the current position index of this iterator
inline
int
getDOFIndex
()
{
return
position
;
}
inline
int
getDOFIndex
()
{
return
position
;
}
protected:
/// Override this to enable iteration through the object
...
...
@@ -237,33 +253,57 @@ namespace AMDiS {
{}
/// Dereference operator
inline
T
&
operator
*
()
{
return
*
it
;
}
inline
T
&
operator
*
()
{
return
*
it
;
}
/// Dereference operator
inline
T
*
operator
->
()
{
return
&
(
*
it
);
}
inline
T
*
operator
->
()
{
return
&
(
*
it
);
}
inline
bool
operator
!=
(
const
DOFIterator
<
T
>&
rhs
)
{
if
(
this
->
iteratedObject
!=
rhs
.
iteratedObject
)
return
true
;
if
(
this
->
it
!=
rhs
.
it
)
return
true
;
inline
bool
operator
!=
(
const
DOFIterator
<
T
>&
rhs
)
{
if
(
this
->
iteratedObject
!=
rhs
.
iteratedObject
)
return
true
;
if
(
this
->
it
!=
rhs
.
it
)
return
true
;
return
false
;
}
inline
bool
operator
==
(
const
DOFIterator
<
T
>&
rhs
)
{
inline
bool
operator
==
(
const
DOFIterator
<
T
>&
rhs
)
{
return
!
(
this
->
operator
==
(
rhs
));
}
protected:
/// Implementation of DOFIteratorBase::goToBeginOfIteratedObject()
inline
void
goToBeginOfIteratedObject
()
{
it
=
iteratedObject
->
begin
();
}
inline
void
goToBeginOfIteratedObject
()
{
it
=
iteratedObject
->
begin
();
}
/// Implementation of DOFIteratorBase::goToEndOfIteratedObject()
inline
void
goToEndOfIteratedObject
()
{
it
=
iteratedObject
->
end
();
}
inline
void
goToEndOfIteratedObject
()
{
it
=
iteratedObject
->
end
();
}
/// Implementation of DOFIteratorBase::incObjectIterator()
inline
void
incObjectIterator
()
{
++
it
;
}
inline
void
incObjectIterator
()
{
++
it
;
}
/// Implementation of DOFIteratorBase::incObjectIterator()
inline
void
decObjectIterator
()
{
--
it
;
}
inline
void
decObjectIterator
()
{
--
it
;
}
protected:
/// Object that is iterated
...
...
AMDiS/src/ParallelDomainProblem.cc
View file @
d5d0ec5a
...
...
@@ -189,9 +189,8 @@ namespace AMDiS {
for
(
std
::
set
<
int
>::
iterator
itRanks
=
partitionDofs
[
it
->
first
].
begin
();
itRanks
!=
partitionDofs
[
it
->
first
].
end
();
++
itRanks
)
{
if
(
*
itRanks
!=
mpiRank
)
{
if
(
*
itRanks
!=
mpiRank
)
sendNewDofs
[
*
itRanks
][
oldDofIndex
]
=
newDofIndex
;
}
}
}
else
{
recvNewDofs
[
it
->
second
].
push_back
((
it
->
first
)[
0
]);
...
...
@@ -261,9 +260,8 @@ namespace AMDiS {
/// === Change dof indices for rank partition. ===
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
rankDofs
.
size
());
i
++
)
{
const_cast
<
DegreeOfFreedom
*>
(
rankDofs
[
i
])[
0
]
=
rstart
+
i
;
}
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
rankDofs
.
size
());
i
++
)
const_cast
<
DegreeOfFreedom
*>
(
rankDofs
[
i
])[
0
]
=
rstart
+
i
;
/// === Create petsc matrix. ===
int
ierr
;
...
...
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