cellToPoint.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 "cellToPoint.H"
00030 #include "polyMesh.H"
00031 #include "cellSet.H"
00032
00033 #include "addToRunTimeSelectionTable.H"
00034
00035
00036
00037 namespace Foam
00038 {
00039
00040 defineTypeNameAndDebug(cellToPoint, 0);
00041
00042 addToRunTimeSelectionTable(topoSetSource, cellToPoint, word);
00043
00044 addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream);
00045
00046 }
00047
00048
00049 Foam::topoSetSource::addToUsageTable Foam::cellToPoint::usage_
00050 (
00051 cellToPoint::typeName,
00052 "\n Usage: cellToPoint <cellSet> all\n\n"
00053 " Select all points of cells in the cellSet\n\n"
00054 );
00055
00056 template<>
00057 const char* Foam::NamedEnum<Foam::cellToPoint::cellAction, 1>::names[] =
00058 {
00059 "all"
00060 };
00061
00062 const Foam::NamedEnum<Foam::cellToPoint::cellAction, 1>
00063 Foam::cellToPoint::cellActionNames_;
00064
00065
00066
00067
00068 void Foam::cellToPoint::combine(topoSet& set, const bool add) const
00069 {
00070
00071 cellSet loadedSet(mesh_, setName_);
00072
00073
00074 for
00075 (
00076 cellSet::const_iterator iter = loadedSet.begin();
00077 iter != loadedSet.end();
00078 ++iter
00079 )
00080 {
00081 label cellI = iter.key();
00082
00083 const labelList& cFaces = mesh_.cells()[cellI];
00084
00085 forAll(cFaces, cFaceI)
00086 {
00087 const face& f = mesh_.faces()[cFaces[cFaceI]];
00088
00089 forAll(f, fp)
00090 {
00091 addOrDelete(set, f[fp], add);
00092 }
00093 }
00094 }
00095 }
00096
00097
00098
00099
00100
00101 Foam::cellToPoint::cellToPoint
00102 (
00103 const polyMesh& mesh,
00104 const word& setName,
00105 const cellAction option
00106 )
00107 :
00108 topoSetSource(mesh),
00109 setName_(setName),
00110 option_(option)
00111 {}
00112
00113
00114
00115 Foam::cellToPoint::cellToPoint
00116 (
00117 const polyMesh& mesh,
00118 const dictionary& dict
00119 )
00120 :
00121 topoSetSource(mesh),
00122 setName_(dict.lookup("set")),
00123 option_(cellActionNames_.read(dict.lookup("option")))
00124 {}
00125
00126
00127
00128 Foam::cellToPoint::cellToPoint
00129 (
00130 const polyMesh& mesh,
00131 Istream& is
00132 )
00133 :
00134 topoSetSource(mesh),
00135 setName_(checkIs(is)),
00136 option_(cellActionNames_.read(checkIs(is)))
00137 {}
00138
00139
00140
00141
00142 Foam::cellToPoint::~cellToPoint()
00143 {}
00144
00145
00146
00147
00148 void Foam::cellToPoint::applyToSet
00149 (
00150 const topoSetSource::setAction action,
00151 topoSet& set
00152 ) const
00153 {
00154 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
00155 {
00156 Pout<< " Adding from " << setName_ << " ..." << endl;
00157
00158 combine(set, true);
00159 }
00160 else if (action == topoSetSource::DELETE)
00161 {
00162 Pout<< " Removing from " << setName_ << " ..." << endl;
00163
00164 combine(set, false);
00165 }
00166 }
00167
00168
00169
Copyright © 2000-2009 OpenCFD Ltd