Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
patch.h
Go to the documentation of this file.
1 /* *******************************************************************
2  * Illinois Open Source License *
3  * *
4  * University of Illinois/NCSA *
5  * Open Source License *
6  * *
7  * Copyright@2008, University of Illinois. All rights reserved. *
8  * *
9  * Developed by: *
10  * *
11  * Center for Simulation of Advanced Rockets *
12  * *
13  * University of Illinois *
14  * *
15  * www.csar.uiuc.edu *
16  * *
17  * Permission is hereby granted, free of charge, to any person *
18  * obtaining a copy of this software and associated documentation *
19  * files (the "Software"), to deal with the Software without *
20  * restriction, including without limitation the rights to use, *
21  * copy, modify, merge, publish, distribute, sublicense, and/or *
22  * sell copies of the Software, and to permit persons to whom the *
23  * Software is furnished to do so, subject to the following *
24  * conditions: *
25  * *
26  * *
27  * @ Redistributions of source code must retain the above copyright *
28  * notice, this list of conditions and the following disclaimers. *
29  * *
30  * @ Redistributions in binary form must reproduce the above *
31  * copyright notice, this list of conditions and the following *
32  * disclaimers in the documentation and/or other materials *
33  * provided with the distribution. *
34  * *
35  * @ Neither the names of the Center for Simulation of Advanced *
36  * Rockets, the University of Illinois, nor the names of its *
37  * contributors may be used to endorse or promote products derived *
38  * from this Software without specific prior written permission. *
39  * *
40  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48  *********************************************************************
49  * Please acknowledge The University of Illinois Center for *
50  * Simulation of Advanced Rockets in works and publications *
51  * resulting from this software or its derivatives. *
52  *********************************************************************/
53 /*
54 A patch is a portion of a block's face.
55 
56 Orion Sky Lawlor, olawlor@acm.org, 6/13/2001
57 */
58 #ifndef __CSAR_PATCH_H
59 #define __CSAR_PATCH_H
60 
61 #include "gridutil.h"
62 
63 #include <string>
64 using std::string;
65 
66 class bcList;
67 class mblockData;
68 class bcListTop;
69 
70 //A rectangular portion of a face
71 class block;
72 class face;
73 
74 class patch {
75  face *f;
76 public:
77  //Location in the source block:
80 
81  void setFace(face *f_) {f=f_;}
82  face *getFace(void) const { return f; }
83 
84  virtual void writeFlo(FILE *out,const bcList &bc)=0;
85  virtual void writeMblock(FILE *out,mblockData &d)=0;
86  virtual void writeTop(FILE *out,const bcListTop &d)=0;
87  virtual bool isExternal(void) const;
88 
89  patch() {}
90  virtual ~patch() {}
91 protected:
92  patch(face *f_,block *src_,const blockSpan &srcSpan_)
93  :f(f_),src(src_),srcSpan(srcSpan_) { }
94 };
95 
96 patch *findPatch(const blockSpan &at,const vector<patch *> &from);
97 
98 //A patch that faces the external world--
99 // between a block and "outside"
100 class externalBCpatch : public patch {
101  friend class block;
102 public:
103  //Gridgen boundary condition number
104  int bcNo;
105 
106  virtual void writeFlo(FILE *out,const bcList &bc);
107  virtual void writeMblock(FILE *out,mblockData &d);
108  virtual void writeTop(FILE *out,const bcListTop &d);
109  virtual bool isExternal(void) const;
110 
113  const blockSpan &srcSpan_,
114  int bcNo_)
115  : patch(f_,src_,srcSpan_), bcNo(bcNo_) { }
116 };
117 
118 //An internal boundary, between blocks
119 class internalBCpatch : public patch {
120 public:
121  //Location in the destination block:
124  internalBCpatch *partner; //Destination patch
126  int type; //Rocflo boundary condition code
127  void setType(int to) {type=to;}
129 
130  virtual void writeFlo(FILE *out,const bcList &bc);
131  virtual void writeMblock(FILE *out,mblockData &d);
132  virtual void writeTop(FILE *out,const bcListTop &d);
133 
134  internalBCpatch(face *f_,block *src_,block *dest_,
135  const blockSpan &srcSpan_,const blockSpan &destSpan_,
136  const orient_t &orient_)
137  : patch(f_,src_,srcSpan_),
138  dest(dest_),destSpan(destSpan_),
139  partner(0),type(1),orient(orient_) { }
140 };
141 
142 #endif
143 
face * f
Definition: patch.h:75
internalBCpatch * partner
Definition: patch.h:124
void setType(int to)
Definition: patch.h:127
virtual void writeTop(FILE *out, const bcListTop &d)=0
Definition: face.h:90
const NT & d
patch()
Definition: patch.h:89
patch(face *f_, block *src_, const blockSpan &srcSpan_)
Definition: patch.h:92
virtual void writeMblock(FILE *out, mblockData &d)
virtual ~patch()
Definition: patch.h:90
blockSpan srcSpan
Definition: patch.h:79
face * getFace(void) const
Definition: patch.h:82
block * src
Definition: patch.h:78
virtual void writeTop(FILE *out, const bcListTop &d)
Definition: writetop.cpp:204
virtual void writeTop(FILE *out, const bcListTop &d)
Definition: writetop.cpp:193
void setFace(face *f_)
Definition: patch.h:81
orient_t orient
Definition: patch.h:128
Definition: adj.h:203
Definition: patch.h:74
externalBCpatch()
Definition: patch.h:111
internalBCpatch(face *f_, block *src_, block *dest_, const blockSpan &srcSpan_, const blockSpan &destSpan_, const orient_t &orient_)
Definition: patch.h:134
block * dest
Definition: patch.h:122
virtual void writeFlo(FILE *out, const bcList &bc)
Definition: writeflo.cpp:178
virtual bool isExternal(void) const
Definition: buildface.cpp:64
void setPartner(internalBCpatch *p)
Definition: patch.h:125
externalBCpatch(face *f_, block *src_, const blockSpan &srcSpan_, int bcNo_)
Definition: patch.h:112
virtual void writeFlo(FILE *out, const bcList &bc)=0
virtual bool isExternal(void) const
Definition: buildface.cpp:63
virtual void writeMblock(FILE *out, mblockData &d)=0
blockSpan destSpan
Definition: patch.h:123
patch * findPatch(const blockSpan &at, const vector< patch * > &from)
Definition: buildface.cpp:90
virtual void writeMblock(FILE *out, mblockData &d)
virtual void writeFlo(FILE *out, const bcList &bc)
Definition: writeflo.cpp:170