splitCell.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "splitCell.H"
00028 #include "error.H"
00029
00030
00031
00032
00033 Foam::splitCell::splitCell(const label cellI, splitCell* parent)
00034 :
00035 cellI_(cellI),
00036 parent_(parent),
00037 master_(NULL),
00038 slave_(NULL)
00039 {}
00040
00041
00042
00043
00044 Foam::splitCell::~splitCell()
00045 {
00046 splitCell* myParent = parent();
00047
00048 if (myParent)
00049 {
00050
00051 if (myParent->master() == this)
00052 {
00053 myParent->master() = NULL;
00054 }
00055 else if (myParent->slave() == this)
00056 {
00057 myParent->slave() = NULL;
00058 }
00059 else
00060 {
00061 FatalErrorIn("splitCell::~splitCell()") << "this not equal to"
00062 << " parent's master or slave pointer" << endl
00063 << "Cell:" << cellLabel() << abort(FatalError);
00064 }
00065 }
00066 }
00067
00068
00069
00070
00071 bool Foam::splitCell::isMaster() const
00072 {
00073 splitCell* myParent = parent();
00074
00075 if (!myParent)
00076 {
00077 FatalErrorIn("splitCell::isMaster()") << "parent not set"
00078 << "Cell:" << cellLabel() << abort(FatalError);
00079
00080 return false;
00081 }
00082 else if (myParent->master() == this)
00083 {
00084 return true;
00085 }
00086 else if (myParent->slave() == this)
00087 {
00088 return false;
00089 }
00090 else
00091 {
00092 FatalErrorIn("splitCell::isMaster()") << "this not equal to"
00093 << " parent's master or slave pointer" << endl
00094 << "Cell:" << cellLabel() << abort(FatalError);
00095
00096 return false;
00097 }
00098 }
00099
00100
00101 bool Foam::splitCell::isUnrefined() const
00102 {
00103 return !master() && !slave();
00104 }
00105
00106
00107 Foam::splitCell* Foam::splitCell::getOther() const
00108 {
00109 splitCell* myParent = parent();
00110
00111 if (!myParent)
00112 {
00113 FatalErrorIn("splitCell::getOther()") << "parent not set"
00114 << "Cell:" << cellLabel() << abort(FatalError);
00115
00116 return NULL;
00117 }
00118 else if (myParent->master() == this)
00119 {
00120 return myParent->slave();
00121 }
00122 else if (myParent->slave() == this)
00123 {
00124 return myParent->master();
00125 }
00126 else
00127 {
00128 FatalErrorIn("splitCell::getOther()") << "this not equal to"
00129 << " parent's master or slave pointer" << endl
00130 << "Cell:" << cellLabel() << abort(FatalError);
00131
00132 return NULL;
00133 }
00134 }
00135
00136
00137
Copyright © 2000-2009 OpenCFD Ltd