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