Rocstar
1.0
Rocstar multiphysics simulation application
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
FaceList.cpp
Go to the documentation of this file.
1
2
#include "
FaceList.hpp
"
3
4
5
FaceList::FaceList
() :
6
d_first(0),
7
d_current(0),
8
d_size(0) {}
9
10
FaceList::FaceList
(
const
FaceList
& olist) :
11
d_size(olist.d_size) {
12
13
// just add all the list
14
Elem
* oval = olist.
d_first
;
15
Elem
* prev(0);
16
while
( oval ){
17
Elem
*nelem =
new
FaceList::Elem
( oval->
d_val
);
18
if
( prev ){
19
prev->
d_next
= nelem;
20
}
21
else
{
22
d_first
= nelem;
23
}
24
prev = nelem;
25
oval = oval->
d_next
;
26
}
27
d_current
=
d_first
;
28
}
29
30
31
FaceList::~FaceList
() {
32
if
(
d_first
)
delete
d_first
;
33
}
34
35
const
FaceList
&
FaceList::operator=
(
const
FaceList
& olist){
36
37
if
(
d_first
)
delete
d_first
;
38
39
d_size
= olist.
d_size
;
40
// just add all the list
41
Elem
* oval = olist.
d_first
;
42
Elem
* prev(0);
43
while
( oval ){
44
Elem
*nelem =
new
FaceList::Elem
( oval->
d_val
);
45
if
( prev ){
46
prev->
d_next
= nelem;
47
}
48
else
{
49
d_first
= nelem;
50
}
51
prev = nelem;
52
oval = oval->
d_next
;
53
}
54
d_current
=
d_first
;
55
return
*
this
;
56
}
57
58
void
FaceList::append
(
Face
* val){
59
60
Elem
* bef(0);
61
Elem
* af(
d_first
);
62
while
( af ){
63
bef = af;
64
af = af->
d_next
;
65
}
66
if
( bef ){
67
bef->
d_next
=
new
FaceList::Elem
( val );
68
}
69
else
{
70
d_first
=
new
Elem
( val );
71
d_current
=
d_first
;
72
}
73
d_size
++;
74
}
75
76
Face
*
FaceList::remove
(){
77
Face
* val =
d_current
->
d_val
;
78
79
d_size
--;
80
81
Elem
* bef(0);
82
Elem
* af(
d_first
);
83
while
( af !=
d_current
){
84
bef = af;
85
af = af->
d_next
;
86
}
87
if
( !bef ){
88
d_first
=
d_current
->
d_next
;
89
}
90
else
{
91
bef->
d_next
=
d_current
->
d_next
;
92
}
93
d_current
=
d_current
->
d_next
;
94
af->
d_next
= 0;
95
delete
af;
// the old current - remove only it
96
if
( !
d_current
)
d_current
=
d_first
;
97
return
val;
98
}
99
100
101
102
boolean
FaceList::move_to
(
Face
* val){
103
d_current
=
d_first
;
104
while
(
d_current
&&
d_current
->
d_val
!= val ){
105
d_current
=
d_current
->
d_next
;
106
}
107
return
(
d_current
?
TRUE
:
FALSE
);
108
}
109
110
int
FaceList::index
()
const
{
111
112
int
ind = 0;
113
Elem
* pass =
d_first
;
114
while
( pass !=
d_current
){
115
ind++;
116
pass = pass->
d_next
;
117
}
118
return
ind;
119
}
120
121
void
FaceList::index
(
int
ind ){
122
123
d_current
=
d_first
;
124
int
i
;
125
for
( i = 0; i < ind; i++ ){
126
d_current
=
d_current
->
d_next
;
127
}
128
}
129
130
FALSE
#define FALSE
Definition:
vinci.h:133
FaceList
Definition:
FaceList.hpp:7
FaceList::Elem
Definition:
FaceList.hpp:35
FaceList::operator=
const FaceList & operator=(const FaceList &olist)
Definition:
FaceList.cpp:35
FaceList::Elem::d_next
Elem * d_next
Definition:
FaceList.hpp:37
FaceList.hpp
FaceList::index
int index() const
Definition:
FaceList.cpp:110
FaceList::FaceList
FaceList()
Definition:
FaceList.cpp:5
FaceList::d_current
Elem * d_current
Definition:
FaceList.hpp:49
i
blockLoc i
Definition:
read.cpp:79
FaceList::Elem::d_val
Face * d_val
Definition:
FaceList.hpp:36
TRUE
#define TRUE
Definition:
vinci.h:134
FaceList::remove
Face * remove()
Definition:
FaceList.cpp:76
FaceList::append
void append(Face *val)
Definition:
FaceList.cpp:58
FaceList::~FaceList
~FaceList()
Definition:
FaceList.cpp:31
FaceList::d_first
Elem * d_first
Definition:
FaceList.hpp:48
FaceList::move_to
boolean move_to(Face *val)
Definition:
FaceList.cpp:102
FaceList::d_size
int d_size
Definition:
FaceList.hpp:51
Face
The Face class is an abstract base class that supplies implemented general methods, as well as a vew virtual interface methods to child classes.
Definition:
Face.hpp:19
Rocfrac
utilities
CohIn
FaceList.cpp
Generated on Wed Nov 30 2016 16:56:07 for Rocstar by
1.8.5