patchRefinement.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "patchRefinement.H"
29 #include "triSurf.H"
30 #include "Istream.H"
31 #include "demandDrivenData.H"
32 
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 :
43  patchName_(),
44  cellSize_(0.0)
45 {
46 }
47 
48 patchRefinement::patchRefinement(const word& n, const scalar& s)
49 :
50  patchName_(n),
51  cellSize_(s)
52 {
53 }
54 
56 :
57  patchName_(is),
58  cellSize_(readScalar(is))
59 {
60 }
61 
62 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
63 
65 {
66 }
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
71 {
72  return patchName_;
73 }
74 
76 {
77  forAll(ts.patches(), patchI)
78  if( ts.patches()[patchI].name() == patchName_ )
79  return patchI;
80 
82  (
83  "label patchRefinement::patchInSurface(const triSurf& ts) const"
84  ) << "Patch " << patchName_
85  << " does not exist in surface " << ts.patches()
86  << exit(FatalError);
87 
88  return -1;
89 }
90 
92 {
93  return cellSize_;
94 }
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
99 {
100  patchName_ = pr.patchName_;
101  cellSize_ = pr.cellSize_;
102 }
103 
105 {
106  pr.patchName_ = word(is);
107  pr.cellSize_ = readScalar(is);
108  return is;
109 }
110 
112 {
113  os << pr.patchName_ << " " << pr.cellSize_ << nl;
114  return os;
115 }
116 
117 bool operator==(const patchRefinement& p1, const patchRefinement& p2)
118 {
119  if( p1.patchName() == p2.patchName() )
120  return true;
121 
122  return false;
123 }
124 
125 bool operator!=(const patchRefinement& p1, const patchRefinement& p2)
126 {
127  return !(p1 == p2);
128 }
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // ************************************************************************* //
triSurf.H
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::operator==
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Foam::patchRefinement::~patchRefinement
~patchRefinement()
Definition: patchRefinement.C:64
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::patchRefinement
Definition: patchRefinement.H:55
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::patchRefinement::patchInSurface
label patchInSurface(const triSurf &) const
Definition: patchRefinement.C:75
Foam::triSurfFacets::patches
const geometricSurfacePatchList & patches() const
access to patches
Definition: triSurfFacetsI.H:49
Istream.H
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
Foam::patchRefinement::operator=
void operator=(const patchRefinement &)
Definition: patchRefinement.C:98
Foam::operator!=
bool operator!=(const particle &, const particle &)
Definition: particle.C:147
Foam::patchRefinement::patchName_
word patchName_
Definition: patchRefinement.H:59
Foam::FatalError
error FatalError
patchRefinement.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
s
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::patchRefinement::patchName
word patchName() const
Definition: patchRefinement.C:70
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::readScalar
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
Foam::operator>>
Istream & operator>>(Istream &, edgeMesh &)
Definition: edgeMeshIO.C:141
Foam::patchRefinement::patchRefinement
patchRefinement()
Null contructor.
Definition: patchRefinement.C:41
FatalErrorIn
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:313
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::triSurf
Definition: triSurf.H:59
Foam::patchRefinement::cellSize
scalar cellSize() const
Definition: patchRefinement.C:91
Foam::patchRefinement::cellSize_
scalar cellSize_
Definition: patchRefinement.H:61