Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rocface.h
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 /* $Id: Rocface.h,v 1.18 2008/12/06 08:43:26 mtcampbe Exp $ */
24 
25 /*==============================================================
26 // This file contains the prototype of Rocface.
27 // Author: Xiangmin Jiao
28 // Created: May 14, 2001
29 //=============================================================*/
30 
31 #ifndef __ROCFACE_H_
32 #define __ROCFACE_H_
33 
34 #include "commpi.h"
35 #include "roccom.h"
36 
37 extern "C" void Rocface_load_module(const char *);
38 extern "C" void Rocface_unload_module(const char *);
39 
40 #ifdef __cplusplus
41 
42 #include "roccom_devel.h"
43 #include "rfc_basic.h"
44 #include <map>
45 
47 
48 class Overlay;
50 
51 class Rocface : public COM_Object {
52 public:
53  typedef std::map<std::string, RFC_Window_transfer*> TRS_Windows;
54 
55  struct Control_parameters {
56  Control_parameters() : verb(0), snap(1.e-3) {}
57 
58  int verb;
59  double snap;
60  };
61 
62 public:
63  Rocface( std::string mname);
64  ~Rocface();
65 
66  static void init( const std::string &);
67  static void finalize( const std::string &);
68 
69  // set verbose level
70  void set_verbose( int *verbose);
71 
72  // read Rocface control file
73  void read_control_file( const char *fname);
74 
75  // Construct the overlay of two meshes.
76  void overlay( const COM::Attribute *mesh1,
77  const COM::Attribute *mesh2,
78  const MPI_Comm *_comm=NULL,
79  const char *path=NULL);
80 
81  // Remove the overlay.
82  void clear_overlay( const char *mesh1,
83  const char *mesh2);
84 
85  // Write out the overlay in HDF format for read-in later.
86  void write_overlay( const COM::Attribute *mesh1,
87  const COM::Attribute *mesh2,
88  const char *prefix1=NULL,
89  const char *prefix2=NULL,
90  const char *format=NULL);
91 
92  // Read in the overlay in HDF format.
93  void read_overlay( const COM::Attribute *mesh1,
94  const COM::Attribute *mesh2,
95  const MPI_Comm *comm,
96  const char *prefix1=NULL,
97  const char *prefix2=NULL,
98  const char *format=NULL);
99 
100  void set_tags( const COM::Attribute *src,
101  const COM::Attribute *trg,
102  const COM::Attribute *tags);
103 
110  void least_squares_transfer( const COM::Attribute *att1,
111  COM::Attribute *att2,
112  const Real *alp=NULL,
113  const int *ord=NULL,
114  Real *tol=NULL,
115  int *iter=NULL);
116 
117  void interpolate( const COM::Attribute *att1,
118  COM::Attribute *att2);
119 
120  void load_transfer( const COM::Attribute *att1,
121  COM::Attribute *att2,
122  const Real *_a=NULL, // Alpha for geometry
123  const int *_o = NULL); // Order of integration
124 protected:
125  // Construct a control window.
126  void create_control_window();
127 
128  static void get_name( const std::string &n1,
129  const std::string &n2,
130  std:: string &aname) {
131  aname = n1+"+"+n2; return;
132  }
133 
134  const RFC_Window_transfer *get_transfer_window( const COM::Attribute *);
135 
136  RFC_Window_transfer *get_transfer_window( COM::Attribute *);
137 
147  template <class Source_type, class Target_type, bool conserv>
148  void transfer( const COM::Attribute *src, COM::Attribute *trg,
149  const Real alpha, const int order=2,
150  Real *tol=NULL, int *iter=NULL, bool load=false);
151 
152  int validate_object() const {
153  if ( _cookie != RFC_COOKIE) return -1;
154  else return COM_Object::validate_object();
155  }
156 
157 protected:
158  enum { RFC_COOKIE=7623223};
159 
160  std::string _mname;
161  Control_parameters _ctrl;
162  TRS_Windows _trs_windows;
163 
164  int _cookie;
165 };
166 
168 
169 #endif /* __cplusplus */
170 #endif /* __ROCFACE_H_ */
171 
172 
173 
174 
175 
176 
This file contains the prototypes for Roccom API.
double Real
Definition: mapbasic.h:322
#define RFC_END_NAME_SPACE
Definition: rfc_basic.h:29
#define RFC_BEGIN_NAME_SPACE
Definition: rfc_basic.h:28
Contains declarations of MPI subroutines used in Roccom.
void Rocface_unload_module(const char *)
Definition: Rocface.C:688
void Rocface_load_module(const char *)
Definition: Rocface.C:686
void read_control_file(const char *fname, Control_parameter &cp)
Definition: advectest.C:115