FreeFOAM The Cross-Platform CFD Toolkit
lduPrimitiveMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::lduPrimitiveMesh
26 
27 Description
28  Simplest contrete lduMesh which stores the addressing needed bu lduMatrix.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef lduPrimitiveMesh_H
33 #define lduPrimitiveMesh_H
34 
35 #include "lduMesh.H"
36 #include <OpenFOAM/labelList.H>
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 /*---------------------------------------------------------------------------*\
44  Class lduPrimitiveMesh Declaration
45 \*---------------------------------------------------------------------------*/
46 
48 :
49  public lduMesh,
50  public lduAddressing
51 {
52  // Private data
53 
54  //- Lower addressing
55  labelList lowerAddr_;
56 
57  //- Upper addressing
58  labelList upperAddr_;
59 
60  //- Patch to internal addressing
61  labelListList patchAddr_;
62 
63  //- List of pointers for each patch
64  // with only those pointing to interfaces being set
65  lduInterfacePtrsList interfaces_;
66 
67  //- Patch field evaluation schedule.
68  // Note this does not need to be held as a copy because it is invariant
69  const lduSchedule& patchSchedule_;
70 
71 
72  // Private Member Functions
73 
74  //- Disallow default bitwise copy construct
76 
77  //- Disallow default bitwise assignment
78  void operator=(const lduPrimitiveMesh&);
79 
80 
81 public:
82 
83  // Constructors
84 
85  //- Construct from components as copies
87  (
88  const label nCells,
89  const unallocLabelList& l,
90  const unallocLabelList& u,
91  const labelListList& pa,
93  const lduSchedule& ps
94  )
95  :
96  lduAddressing(nCells),
97  lowerAddr_(l),
98  upperAddr_(u),
99  patchAddr_(pa),
100  interfaces_(interfaces),
101  patchSchedule_(ps)
102  {}
103 
104 
105  //- Construct from components and re-use storage as specified.
107  (
108  const label nCells,
109  labelList& l,
110  labelList& u,
111  labelListList& pa,
112  lduInterfacePtrsList interfaces,
113  const lduSchedule& ps,
114  bool reUse
115  )
116  :
117  lduAddressing(nCells),
118  lowerAddr_(l, reUse),
119  upperAddr_(u, reUse),
120  patchAddr_(pa, reUse),
121  interfaces_(interfaces, reUse),
122  patchSchedule_(ps)
123  {}
124 
125 
126  // Destructor
127 
129  {}
130 
131 
132  // Member Functions
133 
134  // Access
135 
136  //- Return ldu addressing
137  virtual const lduAddressing& lduAddr() const
138  {
139  return *this;
140  }
141 
142  //- Return a list of pointers for each patch
143  // with only those pointing to interfaces being set
145  {
146  return interfaces_;
147  }
148 
149  //- Return Lower addressing
150  virtual const unallocLabelList& lowerAddr() const
151  {
152  return lowerAddr_;
153  }
154 
155  //- Return Upper addressing
156  virtual const unallocLabelList& upperAddr() const
157  {
158  return upperAddr_;
159  }
160 
161  //- Return patch addressing
162  virtual const unallocLabelList& patchAddr(const label i) const
163  {
164  return patchAddr_[i];
165  }
166 
167  //- Return patch evaluation schedule
168  virtual const lduSchedule& patchSchedule() const
169  {
170  return patchSchedule_;
171  }
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************ vim: set sw=4 sts=4 et: ************************ //