Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / dynamicMesh / dynamicTopoFvMesh / eMesh / ePatches / ePatch / ePatch.C
blobbd2ad7b1dadc970009da5bccbb0810073534a87e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Description
26 \*---------------------------------------------------------------------------*/
28 #include "ePatch.H"
29 #include "addToRunTimeSelectionTable.H"
30 #include "eBoundaryMesh.H"
31 #include "eMesh.H"
32 #include "polyMesh.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace Foam
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 defineTypeNameAndDebug(ePatch, 0);
43 defineRunTimeSelectionTable(ePatch, word);
44 defineRunTimeSelectionTable(ePatch, dictionary);
46 addToRunTimeSelectionTable(ePatch, ePatch, word);
47 addToRunTimeSelectionTable(ePatch, ePatch, dictionary);
49 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
51 Foam::ePatch::ePatch
53     const word& name,
54     const label size,
55     const label start,
56     const label index,
57     const eBoundaryMesh& bm
60     patchIdentifier(name, index),
61     boundaryMesh_(bm),
62     start_(start),
63     size_(size)
67 // Construct from dictionary
68 ePatch::ePatch
70     const word& name,
71     const dictionary& dict,
72     const label index,
73     const eBoundaryMesh& bm
76     patchIdentifier(name, dict, index),
77     boundaryMesh_(bm),
78     start_(readLabel(dict.lookup("start"))),
79     size_(readLabel(dict.lookup("size")))
83 //- Construct as copy, resetting the boundary mesh
84 ePatch::ePatch(const ePatch& p, const eBoundaryMesh& bm)
86     patchIdentifier(p, p.index()),
87     boundaryMesh_(bm),
88     start_(p.start()),
89     size_(p.size())
93 //- Construct as copy
94 ePatch::ePatch(const ePatch& p)
96     patchIdentifier(p),
97     boundaryMesh_(p.boundaryMesh_),
98     start_(p.start_),
99     size_(p.size_)
103 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
105 ePatch::~ePatch()
109 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
111 const eBoundaryMesh& ePatch::boundaryMesh() const
113     return boundaryMesh_;
117 void ePatch::write(Ostream& os) const
119     os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
120     os.writeKeyword("start") << start() << token::END_STATEMENT << nl;
121     os.writeKeyword("size") << size() << token::END_STATEMENT << nl;
122     patchIdentifier::write(os);
126 //- Assignment operator
127 void ePatch::operator=(const ePatch& p)
129     patchIdentifier::operator=(p);
130     start_ = p.start_;
131     size_ = p.size_;
135 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
137 Ostream& operator<<(Ostream& os, const ePatch& p)
139     p.write(os);
140     os.check("Ostream& operator<<(Ostream& f, const faPatch& p)");
141     return os;
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 } // End namespace Foam
149 // ************************************************************************* //