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