Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F79348055
iterator_paradis.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Aug 25, 23:11
Size
4 KB
Mime Type
text/x-c++
Expires
Tue, Aug 27, 23:11 (2 d)
Engine
blob
Format
Raw Data
Handle
20175935
Attached To
rLIBMULTISCALE LibMultiScale
iterator_paradis.hh
View Options
/**
* @file iterator_paradis.hh
*
* @author Till Junge <till.junge@epfl.ch>
*
* @date Wed Jul 09 21:59:47 2014
*
* @brief ParaDiS iterator over DOFs
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __LIBMULTISCALE_ITERATOR_PARADIS_HH__
#define __LIBMULTISCALE_ITERATOR_PARADIS_HH__
/* -------------------------------------------------------------------------- */
//ParaDiS includes
#define PARALLEL
extern
"C"
{
# include "Typedefs.h"
# include "Home.h"
}
#undef PARALLEL
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/**
* Class IteratorPARADISNode
*
*/
class
ContainerPARADISNode
::
iterator
:
public
ContainerPARADISNode
::
iterator_base
{
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public
:
/* Creates an Iterator over the ParaDiS nodes. the argument 'constraint' allows to
* filter only nodes with constraint constraint. See 'Node.h' of the ParaDiS sources
* for the values. The default of -1 means that all nodes are returned.
*/
iterator
(
ContainerPARADISNode
&
c
,
int
constraint
=
-
1
)
:
ContainerPARADISNode
::
iterator_base
(
c
),
constraint
(
constraint
){
node
.
setHome
(
c
.
paradis_ptr
);
};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
RefPARADISNode
&
getFirst
();
RefPARADISNode
&
getNext
();
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
RefPARADISNode
node
;
private
:
int
constraint
;
UInt
index_node
;
};
/* -------------------------------------------------------------------------- */
inline
RefPARADISNode
&
ContainerPARADISNode
::
iterator
::
getFirst
(){
index_node
=
0
;
node
.
index_node
=
index_node
;
if
(
my_cont
.
nbElem
()){
end_flag
=
false
;}
else
{
end_flag
=
true
;
return
node
;
}
//Check if the node actually exists!!
if
(
node
.
paradis_ptr
->
nodeKeys
[
index_node
]
==
(
Node_t
*
)
NULL
){
return
this
->
getNext
();
}
else
if
(
constraint
!=
-
1
&&
node
.
paradis_ptr
->
nodeKeys
[
index_node
]
->
constraint
!=
constraint
)
{
return
this
->
getNext
();
}
else
{
return
node
;}
};
/* -------------------------------------------------------------------------- */
inline
RefPARADISNode
&
ContainerPARADISNode
::
iterator
::
getNext
(){
if
(
static_cast
<
int
>
(
index_node
)
==
node
.
paradis_ptr
->
newNodeKeyPtr
-
1
){
end_flag
=
true
;
return
node
;
}
index_node
++
;
node
.
index_node
=
index_node
;
//Check if the node actually exists (Careful! recursion!) !!
if
(
node
.
paradis_ptr
->
nodeKeys
[
index_node
]
==
(
Node_t
*
)
NULL
){
return
this
->
getNext
();}
else
{
return
node
;}
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif
/* __LIBMULTISCALE_ITERATOR_PARADIS_HH__ */
Event Timeline
Log In to Comment