Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
dynamicMesh
meshCut
splitCell
splitCell.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
\*---------------------------------------------------------------------------*/
25
26
#include "
splitCell.H
"
27
#include <
OpenFOAM/error.H
>
28
29
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30
31
// Construct from cell number and parent
32
Foam::splitCell::splitCell(
const
label cellI,
splitCell
* parent)
33
:
34
cellI_(cellI),
35
parent_(parent),
36
master_(NULL),
37
slave_(NULL)
38
{}
39
40
41
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
42
43
Foam::splitCell::~splitCell
()
44
{
45
splitCell
* myParent = parent();
46
47
if
(myParent)
48
{
49
// Make sure parent does not refer to me anymore.
50
if
(myParent->
master
() ==
this
)
51
{
52
myParent->
master
() = NULL;
53
}
54
else
if
(myParent->
slave
() ==
this
)
55
{
56
myParent->
slave
() = NULL;
57
}
58
else
59
{
60
FatalErrorIn
(
"splitCell::~splitCell()"
) <<
"this not equal to"
61
<<
" parent's master or slave pointer"
<<
endl
62
<<
"Cell:"
<< cellLabel() <<
abort
(
FatalError
);
63
}
64
}
65
}
66
67
68
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69
70
bool
Foam::splitCell::isMaster
()
const
71
{
72
splitCell
* myParent = parent();
73
74
if
(!myParent)
75
{
76
FatalErrorIn
(
"splitCell::isMaster()"
) <<
"parent not set"
77
<<
"Cell:"
<< cellLabel() <<
abort
(
FatalError
);
78
79
return
false
;
80
}
81
else
if
(myParent->
master
() ==
this
)
82
{
83
return
true
;
84
}
85
else
if
(myParent->
slave
() ==
this
)
86
{
87
return
false
;
88
}
89
else
90
{
91
FatalErrorIn
(
"splitCell::isMaster()"
) <<
"this not equal to"
92
<<
" parent's master or slave pointer"
<<
endl
93
<<
"Cell:"
<< cellLabel() <<
abort
(
FatalError
);
94
95
return
false
;
96
}
97
}
98
99
100
bool
Foam::splitCell::isUnrefined
()
const
101
{
102
return
!master() && !slave();
103
}
104
105
106
Foam::splitCell
*
Foam::splitCell::getOther
()
const
107
{
108
splitCell
* myParent = parent();
109
110
if
(!myParent)
111
{
112
FatalErrorIn
(
"splitCell::getOther()"
) <<
"parent not set"
113
<<
"Cell:"
<< cellLabel() <<
abort
(
FatalError
);
114
115
return
NULL;
116
}
117
else
if
(myParent->
master
() ==
this
)
118
{
119
return
myParent->
slave
();
120
}
121
else
if
(myParent->
slave
() ==
this
)
122
{
123
return
myParent->
master
();
124
}
125
else
126
{
127
FatalErrorIn
(
"splitCell::getOther()"
) <<
"this not equal to"
128
<<
" parent's master or slave pointer"
<<
endl
129
<<
"Cell:"
<< cellLabel() <<
abort
(
FatalError
);
130
131
return
NULL;
132
}
133
}
134
135
136
// ************************ vim: set sw=4 sts=4 et: ************************ //