patchToFace.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 "patchToFace.H"
00030 #include "polyMesh.H"
00031
00032 #include "addToRunTimeSelectionTable.H"
00033
00034
00035
00036 namespace Foam
00037 {
00038
00039 defineTypeNameAndDebug(patchToFace, 0);
00040
00041 addToRunTimeSelectionTable(topoSetSource, patchToFace, word);
00042
00043 addToRunTimeSelectionTable(topoSetSource, patchToFace, istream);
00044
00045 }
00046
00047
00048 Foam::topoSetSource::addToUsageTable Foam::patchToFace::usage_
00049 (
00050 patchToFace::typeName,
00051 "\n Usage: patchToFace patch\n\n"
00052 " Select all faces in the patch. Note:accepts wildcards for patch.\n\n"
00053 );
00054
00055
00056
00057
00058 void Foam::patchToFace::combine(topoSet& set, const bool add) const
00059 {
00060 bool hasMatched = false;
00061
00062 forAll(mesh_.boundaryMesh(), patchI)
00063 {
00064 const polyPatch& pp = mesh_.boundaryMesh()[patchI];
00065
00066 if (patchName_.match(pp.name()))
00067 {
00068 Info<< " Found matching patch " << pp.name()
00069 << " with " << pp.size() << " faces." << endl;
00070
00071 hasMatched = true;
00072
00073
00074 for
00075 (
00076 label faceI = pp.start();
00077 faceI < pp.start() + pp.size();
00078 faceI++
00079 )
00080 {
00081 addOrDelete(set, faceI, add);
00082 }
00083 }
00084 }
00085
00086 if (!hasMatched)
00087 {
00088 WarningIn("patchToFace::combine(topoSet&, const bool)")
00089 << "Cannot find any patch named " << patchName_ << endl
00090 << "Valid names are " << mesh_.boundaryMesh().names() << endl;
00091 }
00092 }
00093
00094
00095
00096
00097
00098 Foam::patchToFace::patchToFace
00099 (
00100 const polyMesh& mesh,
00101 const word& patchName
00102 )
00103 :
00104 topoSetSource(mesh),
00105 patchName_(patchName)
00106 {}
00107
00108
00109
00110 Foam::patchToFace::patchToFace
00111 (
00112 const polyMesh& mesh,
00113 const dictionary& dict
00114 )
00115 :
00116 topoSetSource(mesh),
00117 patchName_(dict.lookup("name"))
00118 {}
00119
00120
00121
00122 Foam::patchToFace::patchToFace
00123 (
00124 const polyMesh& mesh,
00125 Istream& is
00126 )
00127 :
00128 topoSetSource(mesh),
00129 patchName_(checkIs(is))
00130 {}
00131
00132
00133
00134
00135 Foam::patchToFace::~patchToFace()
00136 {}
00137
00138
00139
00140
00141 void Foam::patchToFace::applyToSet
00142 (
00143 const topoSetSource::setAction action,
00144 topoSet& set
00145 ) const
00146 {
00147 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
00148 {
00149 Info<< " Adding all faces of patch " << patchName_ << " ..." << endl;
00150
00151 combine(set, true);
00152 }
00153 else if (action == topoSetSource::DELETE)
00154 {
00155 Info<< " Removing all faces of patch " << patchName_ << " ..."
00156 << endl;
00157
00158 combine(set, false);
00159 }
00160 }
00161
00162
00163
Copyright © 2000-2009 OpenCFD Ltd