topoSetSource.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 "topoSetSource.H"
00030 #include "polyMesh.H"
00031 #include "topoSet.H"
00032
00033
00034
00035 namespace Foam
00036 {
00037
00038 defineTypeNameAndDebug(topoSetSource, 0);
00039 defineRunTimeSelectionTable(topoSetSource, word);
00040 defineRunTimeSelectionTable(topoSetSource, istream);
00041
00042
00043 autoPtr<topoSetSource> topoSetSource::New
00044 (
00045 const word& topoSetSourceType,
00046 const polyMesh& mesh,
00047 const dictionary& dict
00048 )
00049 {
00050 wordConstructorTable::iterator cstrIter =
00051 wordConstructorTablePtr_
00052 ->find(topoSetSourceType);
00053
00054 if (cstrIter == wordConstructorTablePtr_->end())
00055 {
00056 FatalErrorIn
00057 (
00058 "topoSetSource::New(const word&, "
00059 "const polyMesh&, const dictionary&)"
00060 ) << "Unknown topoSetSource type " << topoSetSourceType
00061 << endl << endl
00062 << "Valid topoSetSource types : " << endl
00063 << wordConstructorTablePtr_->toc()
00064 << exit(FatalError);
00065 }
00066
00067 return autoPtr<topoSetSource>(cstrIter()(mesh, dict));
00068 }
00069
00070
00071
00072 autoPtr<topoSetSource> topoSetSource::New
00073 (
00074 const word& topoSetSourceType,
00075 const polyMesh& mesh,
00076 Istream& is
00077 )
00078 {
00079 istreamConstructorTable::iterator cstrIter =
00080 istreamConstructorTablePtr_
00081 ->find(topoSetSourceType);
00082
00083 if (cstrIter == istreamConstructorTablePtr_->end())
00084 {
00085 FatalErrorIn
00086 (
00087 "topoSetSource::New(const word&, "
00088 "const polyMesh&, Istream&)"
00089 ) << "Unknown topoSetSource type " << topoSetSourceType
00090 << endl << endl
00091 << "Valid topoSetSource types : " << endl
00092 << istreamConstructorTablePtr_->toc()
00093 << exit(FatalError);
00094 }
00095
00096 return autoPtr<topoSetSource>(cstrIter()(mesh, is));
00097 }
00098
00099
00100 }
00101
00102
00103 Foam::HashTable<Foam::string>* Foam::topoSetSource::usageTablePtr_ = NULL;
00104
00105 template<>
00106 const char* Foam::NamedEnum<Foam::topoSetSource::setAction, 7>::names[] =
00107 {
00108 "clear",
00109 "new",
00110 "invert",
00111 "add",
00112 "delete",
00113 "subset",
00114 "list"
00115 };
00116
00117
00118 const Foam::NamedEnum<Foam::topoSetSource::setAction, 7>
00119 Foam::topoSetSource::actionNames_;
00120
00121
00122 const Foam::string Foam::topoSetSource::illegalSource_
00123 (
00124 "Illegal topoSetSource name"
00125 );
00126
00127
00128 Foam::Istream& Foam::topoSetSource::checkIs(Istream& is)
00129 {
00130 if (is.good() && !is.eof())
00131 {
00132 return is;
00133 }
00134 else
00135 {
00136 FatalErrorIn("cellToFace::cellToFace") << "Istream not good"
00137 << exit(FatalError);
00138
00139 return is;
00140 }
00141 }
00142
00143
00144
00145
00146 void Foam::topoSetSource::addOrDelete
00147 (
00148 topoSet& set,
00149 const label cellI,
00150 const bool add
00151 ) const
00152 {
00153 if (add)
00154 {
00155 set.insert(cellI);
00156 }
00157 else
00158 {
00159 set.erase(cellI);
00160 }
00161 }
00162
00163
00164
00165
00166
00167 Foam::topoSetSource::topoSetSource(const polyMesh& mesh)
00168 :
00169 mesh_(mesh)
00170 {}
00171
00172
00173
00174
00175 Foam::topoSetSource::~topoSetSource()
00176 {}
00177
00178
00179
Copyright © 2000-2009 OpenCFD Ltd