Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-fem-dg
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
Service Desk
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
dune-fem
dune-fem-dg
Commits
81df0a3c
Commit
81df0a3c
authored
14 years ago
by
Robert Klöfkorn
Browse files
Options
Downloads
Patches
Plain Diff
make domaindecomposed iterator a singleton class.
parent
3f4d99ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/fem-dg/pass/domaindecomposed.hh
+106
-2
106 additions, 2 deletions
dune/fem-dg/pass/domaindecomposed.hh
dune/fem-dg/pass/threadfilter.hh
+1
-3
1 addition, 3 deletions
dune/fem-dg/pass/threadfilter.hh
dune/fem-dg/pass/threadpass.hh
+9
-4
9 additions, 4 deletions
dune/fem-dg/pass/threadpass.hh
with
116 additions
and
9 deletions
dune/fem-dg/pass/domaindecomposed.hh
+
106
−
2
View file @
81df0a3c
...
...
@@ -94,7 +94,7 @@ namespace Dune {
const
size_t
maxThreads
=
ThreadManager
::
maxThreads
()
;
// create partitioner
Partitioner
<
GridType
>
db
(
space_
.
gridPart
()
,
maxThreads
);
Partitioner
<
Grid
Part
Type
>
db
(
space_
.
gridPart
()
,
maxThreads
);
// do partitioning
db
.
serialPartition
(
false
);
...
...
@@ -128,7 +128,7 @@ namespace Dune {
if
(
Parameter
::
verbose
()
)
{
for
(
size_t
i
=
0
;
i
<
maxThreads
;
++
i
)
std
::
cout
<<
"T["
<<
i
<<
"] = "
<<
counter
[
i
]
<<
std
::
endl
;
std
::
cout
<<
"
DomainDecomposedIterator:
T["
<<
i
<<
"] = "
<<
counter
[
i
]
<<
std
::
endl
;
}
//for(size_t i = 0; i<size; ++i )
...
...
@@ -176,6 +176,110 @@ namespace Dune {
#endif
}
};
/** \brief Thread iterator */
template
<
class
DiscreteFunctionSpace
>
class
DomainDecomposedIteratorStorage
{
typedef
DiscreteFunctionSpace
SpaceType
;
public:
typedef
DiscreteFunctionSpace
DiscreteFunctionSpaceType
;
typedef
typename
SpaceType
::
GridPartType
GridPartType
;
typedef
typename
SpaceType
::
IndexSetType
IndexSetType
;
typedef
DomainDecomposedIterator
<
DiscreteFunctionSpace
>
DomainIterator
;
typedef
typename
DomainIterator
::
IteratorType
IteratorType
;
typedef
typename
IteratorType
::
Entity
EntityType
;
private:
struct
IteratorFactory
{
struct
Key
{
const
DiscreteFunctionSpaceType
&
space_
;
const
IndexSetType
&
indexSet_
;
Key
(
const
DiscreteFunctionSpaceType
&
space
)
:
space_
(
space
),
indexSet_
(
space_
.
indexSet
()
)
{}
bool
operator
==
(
const
Key
&
other
)
const
{
// compare grid pointers
return
(
&
indexSet_
)
==
(
&
other
.
indexSet_
);
}
const
DiscreteFunctionSpaceType
&
space
()
const
{
return
space_
;
}
};
typedef
DomainIterator
ObjectType
;
typedef
Key
KeyType
;
inline
static
ObjectType
*
createObject
(
const
KeyType
&
key
)
{
return
new
ObjectType
(
key
.
space
()
);
}
inline
static
void
deleteObject
(
ObjectType
*
object
)
{
delete
object
;
}
};
typedef
typename
IteratorFactory
::
KeyType
KeyType
;
typedef
SingletonList
<
KeyType
,
DomainIterator
,
IteratorFactory
>
IndexSetProviderType
;
protected
:
DomainIterator
&
iterators_
;
public
:
//! contructor creating thread iterators
explicit
DomainDecomposedIteratorStorage
(
const
DiscreteFunctionSpaceType
&
spc
)
:
iterators_
(
IndexSetProviderType
::
getObject
(
KeyType
(
spc
)
)
)
{
update
();
}
~
DomainDecomposedIteratorStorage
()
{
IndexSetProviderType
::
removeObject
(
iterators_
);
}
//! return reference to space
const
SpaceType
&
space
()
const
{
return
iterators_
.
space
();
}
//! update internal list of iterators
void
update
()
{
iterators_
.
update
();
}
//! return begin iterator for current thread
IteratorType
begin
()
const
{
return
iterators_
.
begin
();
}
//! return end iterator for current thread
IteratorType
end
()
const
{
return
iterators_
.
end
();
}
//! return thread number this entity belongs to
int
index
(
const
EntityType
&
entity
)
const
{
return
iterators_
.
index
(
entity
);
}
//! return thread number this entity belongs to
int
thread
(
const
EntityType
&
entity
)
const
{
return
iterators_
.
thread
(
entity
);
}
};
}
}
...
...
This diff is collapsed.
Click to expand it.
dune/fem-dg/pass/threadfilter.hh
+
1
−
3
View file @
81df0a3c
...
...
@@ -13,13 +13,11 @@
#include
<dune/fem/misc/gridwidth.hh>
#include
<dune/fem/quadrature/cachingquadrature.hh>
#include
"includes.hh"
namespace
Dune
{
//***************************************************************************
//
//
FFS
Filter
//
Thread
Filter
//
//***************************************************************************
template
<
class
GridPartType
>
...
...
This diff is collapsed.
Click to expand it.
dune/fem-dg/pass/threadpass.hh
+
9
−
4
View file @
81df0a3c
...
...
@@ -87,7 +87,7 @@ namespace Dune {
typedef
typename
GridPartType
::
IndexSetType
IndexSetType
;
//typedef Fem::ThreadIterator< DiscreteFunctionSpaceType > ThreadIteratorType;
typedef
Fem
::
DomainDecomposedIterator
<
DiscreteFunctionSpaceType
>
ThreadIteratorType
;
typedef
Fem
::
DomainDecomposedIterator
Storage
<
DiscreteFunctionSpaceType
>
ThreadIteratorType
;
public
:
//- Public methods
...
...
@@ -287,9 +287,14 @@ namespace Dune {
// program, this would give conflicts)
myPass
.
finalize
(
arg
,
dest
);
#ifndef NDEBUG
std
::
cout
<<
"Thread["
<<
Fem
::
ThreadManager
::
thread
()
<<
"] diagnostics: "
<<
nbChecker
.
counter_
<<
" and "
<<
nbChecker
.
nonEqual_
<<
std
::
endl
;
#if not defined NDEBUG
/*
if( Parameter :: verbose() )
{
std::cout << "Thread["<< Fem::ThreadManager::thread() << "] diagnostics: " <<
nbChecker.counter_ << " and "<< nbChecker.nonEqual_ << std::endl;
}
*/
#endif
}
/////////////////////////////////////////////////
...
...
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