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