boxToPoint.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 "boxToPoint.H"
00030 #include "polyMesh.H"
00031
00032 #include "addToRunTimeSelectionTable.H"
00033
00034
00035
00036 namespace Foam
00037 {
00038
00039 defineTypeNameAndDebug(boxToPoint, 0);
00040
00041 addToRunTimeSelectionTable(topoSetSource, boxToPoint, word);
00042
00043 addToRunTimeSelectionTable(topoSetSource, boxToPoint, istream);
00044
00045 }
00046
00047
00048 Foam::topoSetSource::addToUsageTable Foam::boxToPoint::usage_
00049 (
00050 boxToPoint::typeName,
00051 "\n Usage: boxToPoint ((minx miny minz) (maxx maxy maxz))\n\n"
00052 " Select all points with coordinate within bounding box\n\n"
00053 );
00054
00055
00056
00057
00058 void Foam::boxToPoint::combine(topoSet& set, const bool add) const
00059 {
00060 const pointField& pts = mesh_.points();
00061
00062 forAll(pts, pointI)
00063 {
00064 if (bb_.contains(pts[pointI]))
00065 {
00066 addOrDelete(set, pointI, add);
00067 }
00068 }
00069 }
00070
00071
00072
00073
00074
00075 Foam::boxToPoint::boxToPoint
00076 (
00077 const polyMesh& mesh,
00078 const treeBoundBox& bb
00079 )
00080 :
00081 topoSetSource(mesh),
00082 bb_(bb)
00083 {}
00084
00085
00086
00087 Foam::boxToPoint::boxToPoint
00088 (
00089 const polyMesh& mesh,
00090 const dictionary& dict
00091 )
00092 :
00093 topoSetSource(mesh),
00094 bb_(dict.lookup("box"))
00095 {}
00096
00097
00098
00099 Foam::boxToPoint::boxToPoint
00100 (
00101 const polyMesh& mesh,
00102 Istream& is
00103 )
00104 :
00105 topoSetSource(mesh),
00106 bb_(checkIs(is))
00107 {}
00108
00109
00110
00111
00112 Foam::boxToPoint::~boxToPoint()
00113 {}
00114
00115
00116
00117
00118 void Foam::boxToPoint::applyToSet
00119 (
00120 const topoSetSource::setAction action,
00121 topoSet& set
00122 ) const
00123 {
00124 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
00125 {
00126 Info<< " Adding points that are within box " << bb_ << " ..."
00127 << endl;
00128
00129 combine(set, true);
00130 }
00131 else if (action == topoSetSource::DELETE)
00132 {
00133 Info<< " Removing points that are within box " << bb_ << " ..."
00134 << endl;
00135
00136 combine(set, false);
00137 }
00138 }
00139
00140
00141
Copyright © 2000-2009 OpenCFD Ltd