refineCell.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
00028
00029 #include "refineCell.H"
00030 #include "error.H"
00031
00032
00033
00034
00035 Foam::refineCell::refineCell()
00036 :
00037 cellNo_(-1),
00038 direction_(vector::zero)
00039 {}
00040
00041
00042
00043 Foam::refineCell::refineCell(const label cellI, const vector& direction)
00044 :
00045 cellNo_(cellI),
00046 direction_(direction)
00047 {
00048 scalar magDir = mag(direction_);
00049
00050 if (magDir < SMALL)
00051 {
00052 FatalErrorIn("refineCell(const label, const vector&)")
00053 << "(almost)zero vector as direction for cell " << cellNo_
00054 << abort(FatalError);
00055 }
00056 else if (mag(magDir - 1) > SMALL)
00057 {
00058
00059 direction_ /= mag(direction_);
00060 }
00061 }
00062
00063
00064
00065 Foam::refineCell::refineCell(Istream& is)
00066 :
00067 cellNo_(readLabel(is)),
00068 direction_(is)
00069 {
00070 scalar magDir = mag(direction_);
00071
00072 if (magDir < SMALL)
00073 {
00074 FatalErrorIn("refineCell(Istream&)")
00075 << "(almost)zero vector as direction for cell " << cellNo_
00076 << abort(FatalError);
00077 }
00078 else if (mag(magDir - 1) > SMALL)
00079 {
00080
00081 direction_ /= mag(direction_);
00082 }
00083 }
00084
00085
00086
00087
00088 Foam::Ostream& Foam::operator<<(Ostream& os, const refineCell& r)
00089 {
00090 if (os.format() == IOstream::ASCII)
00091 {
00092 os << r.cellNo() << token::SPACE << r.direction();
00093 }
00094 else
00095 {
00096 os << r.cellNo() << r.direction();
00097 }
00098 return os;
00099 }
00100
00101
00102
00103
Copyright © 2000-2009 OpenCFD Ltd