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