Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rocface.C
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.C,v 1.36 2009/10/08 15:35:59 mtcampbe Exp $
24 
25 //==============================================================
26 // This file contains the class implementation for Rocface.
27 // Author: Xiangmin Jiao
28 // Created: May 14, 2001
29 //==============================================================
30 
31 #include "rfc_basic.h"
32 #include <string>
33 #include <cstring>
34 #include "Rocface.h"
35 #include "Overlay.h"
36 #include "Transfer_2f.h"
37 #include "Transfer_2n.h"
38 
40 
41 Rocface::Rocface( std::string mname) : _mname(mname), _cookie(RFC_COOKIE) {}
42 
43 
44 Rocface::~Rocface() {
45  while ( !_trs_windows.empty()) {
46  TRS_Windows::iterator it = _trs_windows.begin();
47  delete it->second;
48  _trs_windows.erase( it);
49  }
50 }
51 
52 void Rocface::
53 set_verbose( int *verb)
54 {
55  RFC_assertion_msg( verb, "NULL pointer");
56  _ctrl.verb = *verb;
57 }
58 
59 // Associate two windows given by a1->window() and a2->window().
60 void Rocface::
61 overlay( const COM::Attribute *a1,
62  const COM::Attribute *a2,
63  const MPI_Comm *comm,
64  const char *path) {
65  COM_assertion_msg( validate_object()==0, "Invalid object");
66 
67  std::string n1 = a1->window()->name();
68  std::string n2 = a2->window()->name();
69 
70  Overlay ovl( a1->window(), a2->window(), path);
71  ovl.set_tolerance( _ctrl.snap); // set tolerance for snapping vertices
72 
73  // Perform overlay
74  ovl.overlay();
75 
76  // Create new data structures for data transfer.
77  std::string wn1, wn2;
78  get_name( n1, n2, wn1); get_name( n2, n1, wn2);
79 
80  TRS_Windows::iterator it1 = _trs_windows.find( wn1);
81  TRS_Windows::iterator it2 = _trs_windows.find( wn2);
82  if ( it1 != _trs_windows.end()) {
83  RFC_assertion( it2 != _trs_windows.end());
84  delete it1->second; delete it2->second;
85  }
86  else {
87  it1 = _trs_windows.
88  insert( TRS_Windows::value_type( wn1, NULL)).first;
89  RFC_assertion( it2 == _trs_windows.end());
90  it2 = _trs_windows.
91  insert( TRS_Windows::value_type( wn2, NULL)).first;
92  }
93 
94  MPI_Comm com = (comm==NULL)?MPI_COMM_WORLD:*comm;
95  it1->second = new RFC_Window_transfer(const_cast<COM::Window*>(a1->window()),
96  BLUE, com);
97  it2->second = new RFC_Window_transfer(const_cast<COM::Window*>(a2->window()),
98  GREEN, com);
99 
100  ovl.export_windows( it1->second, it2->second);
101 }
102 
103 // Destroy the overlay of two windows.
104 void Rocface::
105 clear_overlay( const char *m1,
106  const char *m2) {
107  COM_assertion_msg( validate_object()==0, "Invalid object");
108 
109  std::string n1 = m1;
110  std::string n2 = m2;
111 
112  // Create new data structures for data transfer.
113  std::string wn1, wn2;
114  get_name( n1, n2, wn1); get_name( n2, n1, wn2);
115 
116  TRS_Windows::iterator it1 = _trs_windows.find( wn1);
117  if ( it1 != _trs_windows.end()) {
118  delete it1->second; _trs_windows.erase( it1);
119 
120  TRS_Windows::iterator it2 = _trs_windows.find( wn2);
121  RFC_assertion( it2 != _trs_windows.end());
122  delete it2->second; _trs_windows.erase( it2);
123  }
124  else {
125  std::cerr << "Rocface: ERROR: The overlay of window \"" << n1
126  << "\" and window \"" << n2 << "\" does not exist for deleting"
127  << std::endl;
128  RFC_assertion(false); MPI_Abort(MPI_COMM_WORLD, -1);
129  }
130 }
131 
132 // Read in the two windows in binary or Rocin format.
133 void Rocface::
134 read_overlay( const COM::Attribute *a1,
135  const COM::Attribute *a2,
136  const MPI_Comm *comm,
137  const char *prefix1,
138  const char *prefix2,
139  const char *format) {
140  COM_assertion_msg( validate_object()==0, "Invalid object");
141 
142  std::string n1 = a1->window()->name();
143  std::string n2 = a2->window()->name();
144 
145  // Create new data structures for data transfer.
146  std::string wn1, wn2;
147  get_name( n1, n2, wn1); get_name( n2, n1, wn2);
148 
149  TRS_Windows::iterator it1 = _trs_windows.find( wn1);
150  TRS_Windows::iterator it2 = _trs_windows.find( wn2);
151 
152  if ( it1 != _trs_windows.end()) {
153  RFC_assertion( it2 != _trs_windows.end());
154  delete it1->second; delete it2->second;
155  }
156  else {
157  it1 = _trs_windows.
158  insert( TRS_Windows::value_type( wn1, NULL)).first;
159  it2 = _trs_windows.
160  insert( TRS_Windows::value_type( wn2, NULL)).first;
161  }
162 
163 
164  MPI_Comm com = (comm==NULL)?a1->window()->get_communicator():*comm;
165  it1->second = new RFC_Window_transfer(const_cast<COM::Window*>(a1->window()),
166  BLUE, com, prefix1, format);
167  COM_assertion(comm||com==a2->window()->get_communicator());
168  it2->second = new RFC_Window_transfer(const_cast<COM::Window*>(a2->window()),
169  GREEN, com, prefix2, format);
170 
171  if ( prefix1 == NULL) prefix1 = n1.c_str();
172  if ( prefix2 == NULL) prefix2 = n2.c_str();
173 
174  if ( it1->second->comm_rank()==0 && _ctrl.verb) {
175  std::cout << "RFACE: Reading in subdivision of window " << n1
176  << " from files with prefix \""
177  << prefix1 << "\"...." << std::flush;
178  }
179  it1->second->read_sdv( prefix1, format);
180  if ( it1->second->comm_rank()==0 && _ctrl.verb) {
181  std::cout << "Done" << std::endl;
182  }
183 
184  if ( it2->second->comm_rank()==0 && _ctrl.verb) {
185  std::cout << "RFACE: Reading in subdivision of window " << n2
186  << " from files with prefix \""
187  << prefix2 << "\"...." << std::flush;
188  }
189  it2->second->read_sdv( prefix2, format);
190  if ( it2->second->comm_rank()==0 && _ctrl.verb) {
191  std::cout << "Done" << std::endl;
192  }
193 }
194 
195 // Write out the two windows in binary or Rocout format.
196 // Precondition: The overlay has been computed previously.
197 void Rocface::
198 write_overlay( const COM::Attribute *a1,
199  const COM::Attribute *a2,
200  const char *prefix1,
201  const char *prefix2,
202  const char *format) {
203  COM_assertion_msg( validate_object()==0, "Invalid object");
204 
205  std::string n1 = a1->window()->name();
206  std::string n2 = a2->window()->name();
207 
208  // Create new data structures for data transfer.
209  std::string wn1, wn2;
210  get_name( n1, n2, wn1); get_name( n2, n1, wn2);
211 
212  TRS_Windows::iterator it1 = _trs_windows.find( wn1);
213  if ( it1 == _trs_windows.end()) {
214  std::cerr << "RFACE: ERROR: The overlay of window \"" << n1
215  << "\" and window \"" << n2 << "\" does not exist for output"
216  << std::endl;
217  RFC_assertion( false); MPI_Abort( MPI_COMM_WORLD, -1);
218  }
219 
220  TRS_Windows::iterator it2 = _trs_windows.find( wn2);
221  RFC_assertion( it2 != _trs_windows.end());
222 
223  if ( prefix1 == NULL) prefix1 = n1.c_str();
224  if ( prefix2 == NULL) prefix2 = n2.c_str();
225 
226  if ( it1->second->comm_rank()==0 && _ctrl.verb) {
227  std::cout << "RFACE: Writing subdivision of window \""
228  << n1 << "\"...." << std::flush;
229  }
230  if ( format && std::strcmp( format, "Tecplot")==0) {
231  it1->second->write_tec_ascii( (std::string(prefix1)+"_orig").c_str());
232  it1->second->write_tec_sub( prefix1);
233  }
234  else
235  it1->second->write_sdv( prefix1, format);
236 
237  if ( it1->second->comm_rank()==0 && _ctrl.verb) {
238  std::cout << "Done" << std::endl;
239  }
240 
241  if ( it2->second->comm_rank()==0 && _ctrl.verb) {
242  std::cout << "Writing subdivision of window \""
243  << n2 << "\"...." << std::flush;
244  }
245 
246  if ( format && std::strcmp( format, "Tecplot")==0) {
247  it2->second->write_tec_ascii( (std::string(prefix2)+"_orig").c_str());
248  it2->second->write_tec_sub( prefix2);
249  }
250  else
251  it2->second->write_sdv( prefix2, format);
252 
253  if ( it2->second->comm_rank()==0 && _ctrl.verb) {
254  std::cout << "Done" << std::endl;
255  }
256 }
257 
258 const RFC_Window_transfer *
259 Rocface::get_transfer_window( const COM::Attribute *attr) {
260  return _trs_windows.find( attr->window()->name())->second;
261 }
263 Rocface::get_transfer_window( COM::Attribute *attr) {
264  return _trs_windows.find( attr->window()->name())->second;
265 }
266 
267 void Rocface::
268 set_tags( const COM::Attribute *src, const COM::Attribute *trg,
269  const COM::Attribute *tags) {
270  COM_assertion_msg( validate_object()==0, "Invalid object");
271 
272  RFC_assertion( tags && tags->data_type() == COM_INT ||
273  tags->data_type() == COM_INTEGER );
274 
275  std::string n1 = src->window()->name();
276  std::string n2 = trg->window()->name();
277 
278  std::string wn2;
279  get_name( n2, n1, wn2);
280 
281  TRS_Windows::iterator it2 = _trs_windows.find( wn2);
282 
283  if ( it2 == _trs_windows.end()) {
284  std::cerr << "Rocface: ERROR: The overlay of window \"" << n1
285  << "\" and window \"" << n2 << "\" does not exist"
286  << std::endl;
287  RFC_assertion( false); MPI_Abort( MPI_COMM_WORLD, -1);
288  }
289 
290  // Loop through the panes
291  it2->second->set_tags( tags);
292 }
293 
294 /****************************************************************
295  * Template traits for data transfer and specializations
296  ****************************************************************/
297 
299 template <class Source_type, class Target_type, bool conserv>
301  public:
302  typedef void *Transfer_type;
303 
315  static void transfer( Transfer_type &trans,
316  Source_type &sf, Target_type &tf,
317  const Real alpha, const int order,
318  Real *tol, int *iter,
319  const int verbose, const bool load);
320 };
321 
322 // Wrapper for nonconservative interpolation.
323 template <>
325  public:
327 
328  static void transfer( Transfer_type &trans,
329  Nodal_data_const &sf, Nodal_data &tf,
330  const Real alpha, const int order,
331  Real *tol, int *iter,
332  const int verbose, const bool) {
333  trans.transfer( sf, tf, verbose);
334  }
335 };
336 
337 // Wrapper for conservative nodes-to-faces transfer.
338 template <>
340  public:
342 
343  static void transfer( Transfer_type &trans,
344  Nodal_data_const &sf, Facial_data &tf,
345  const Real alpha, const int order,
346  Real *tol, int *iter,
347  const int verbose, const bool) {
348  trans.transfer( sf, tf, alpha, order, verbose);
349  }
350 };
351 
352 // Wrapper for conservative faces-to-faces transfer.
353 template <>
355  public:
357 
358  static void transfer( Transfer_type &trans,
359  Facial_data_const &sf, Facial_data &tf,
360  const Real alpha, const int order,
361  Real *tol, int *iter,
362  const int verbose, const bool) {
363  trans.transfer( sf, tf, alpha, order, verbose);
364  }
365 };
366 
367 // Wrapper for conservative faces-to-nodes transfer.
368 template <>
370  public:
372 
374  static void transfer( Transfer_type &trans,
375  Facial_data_const &sf, Nodal_data &tf,
376  const Real alpha, const int order,
377  Real *tol, int *iter,
378  const int verbose, const bool load) {
379  if ( !load)
380  trans.transfer( sf, tf, alpha, tol, iter, order, verbose);
381  else
382  trans.comp_loads( sf, tf, alpha, order, verbose);
383  }
384 };
385 
386 // Wrapper for conservative nodes-to-nodes transfer.
387 template <>
389 public:
391 
392  static void transfer( Transfer_type &trans,
393  Nodal_data_const &sf, Nodal_data &tf,
394  const Real alpha, const int order,
395  Real *tol, int *iter,
396  const int verbose, const bool load) {
397  if ( !load)
398  trans.transfer( sf, tf, alpha, tol, iter, order, verbose);
399  else
400  trans.comp_loads( sf, tf, alpha, order, verbose);
401  }
402 };
403 
404 // Template implementation for transfering data between meshes.
405 template <class Source_type, class Target_type, bool conserv>
406 void Rocface::transfer( const COM::Attribute *src, COM::Attribute *trg,
407  const Real alpha, const int order,
408  Real *tol, int *iter, bool load) {
410 
411  std::string n1 = src->window()->name();
412  std::string n2 = trg->window()->name();
413 
414  std::string wn1, wn2;
415  get_name( n1, n2, wn1); get_name( n2, n1, wn2);
416 
417  TRS_Windows::iterator it1 = _trs_windows.find( wn1);
418  TRS_Windows::iterator it2 = _trs_windows.find( wn2);
419 
420  if ( it1 == _trs_windows.end() || it2 == _trs_windows.end()) {
421  std::cerr << "RFACE: ERROR: The overlay of window \"" << n1
422  << "\" and window \"" << n2 << "\" does not exist"
423  << std::endl;
424  RFC_assertion( false); MPI_Abort( MPI_COMM_WORLD, -1);
425  }
426 
427  if ( !it1->second->replicated()) {
428  it1->second->replicate_metadata( *it2->second);
429  }
430 
431  Target_type tf( trg);
432  Source_type sf( src);
433 
434  RFC_Window_transfer *w1=it1->second, *w2=it2->second;
435  typename Traits::Transfer_type trans( w1, w2);
436 
437  // Print min, max, and integral before transfer
438  if ( _ctrl.verb) {
439  if ( w2->comm_rank()==0) {
440  if (conserv)
441  std::cout << "RFACE: Conservatively transferring ";
442  else
443  std::cout << "RFACE: Interpolating ";
444  std::cout << " from " << w1->name()+"."+src->name()
445  << " to " << w2->name()+"."+trg->name() << std::endl;
446  }
447  Vector_n min_v( sf.dimension()), max_v(sf.dimension());
448  trans.minmax( *w1, sf, min_v, max_v);
449 
450  Vector_n integral(sf.dimension(),0);
451  trans.integrate( *w1, sf, integral, order);
452 
453  if ( w1->comm_rank()==0 && _ctrl.verb) {
454  std::cout << "RFACE: Before transfer\nRFACE:\tminimum: " << min_v
455  << "\nRFACE:\tmaximum: " << max_v;
456  if ( !load)
457  std::cout << "\nRFACE:\tintegral: " << std::setprecision(10)
458  << integral;
459  std::cout << std::endl;
460  }
461  }
462 
463  // Perform data transfer
464  Traits::transfer( trans, sf, tf, alpha, order, tol, iter, _ctrl.verb, load);
465 
466  // Print min, max, and integral after transfer
467  if ( _ctrl.verb) {
468  Vector_n min_v( sf.dimension()), max_v(sf.dimension());
469  trans.minmax( *w2, tf, min_v, max_v);
470 
471  Vector_n integral(sf.dimension(),0);
472  trans.integrate( *w2, tf, integral, order);
473 
474  if ( w2->comm_rank()==0 && _ctrl.verb) {
475  std::cout << "RFACE: After transfer\nRFACE:\tminimum: " << min_v
476  << "\nRFACE:\tmaximum: " << max_v;
477  if ( !load)
478  std::cout << "\nRFACE:\tintegral: " << std::setprecision(10)
479  << integral;
480  std::cout << std::endl;
481  }
482  }
483 
484  // Reset the tags, which indicate which nodes/elements should receive values
485  w2->set_tags( NULL);
486 }
487 
488 // Transfer data from a window to another using the least squares
489 // data transfer formulation.
490 void Rocface::
491 least_squares_transfer( const COM::Attribute *src,
492  COM::Attribute *trg,
493  const Real *alp_in,
494  const int *ord_in,
495  Real *tol_io,
496  int *iter_io)
497 {
498  COM_assertion_msg( validate_object()==0, "Invalid object");
499 
500  Real alpha = (alp_in == NULL) ? 1. : *alp_in;
501  int order = (ord_in == NULL) ? 1+trg->is_nodal() : *ord_in;
502 
503  COM_assertion( alpha>=0 && alpha<=1);
504 
505  if ( trg->is_nodal()) {
506  Real tol = (tol_io == NULL) ? 1.e-6 : *tol_io;
507  int iter = (iter_io == NULL) ? 100 : *iter_io;
508 
509  if ( src->is_nodal()) {
510  transfer<Nodal_data_const, Nodal_data, true>
511  ( src, trg, alpha, order, &tol, &iter);
512  }
513  else {
514  transfer<Facial_data_const, Nodal_data, true>
515  ( src, trg, alpha, order, &tol, &iter);
516  }
517 
518  if (tol_io != NULL) *tol_io = tol;
519  if (iter_io != NULL) *iter_io = iter;
520  }
521  else {
522  if ( src->is_nodal()) {
523  transfer<Nodal_data_const, Facial_data, true>
524  ( src, trg, alpha, order);
525  }
526  else {
527  transfer< Facial_data_const, Facial_data, true>
528  ( src, trg, alpha, order);
529  }
530  }
531 }
532 
533 // Transfer data from a window to another using the traditional interpolation.
534 void Rocface::
535 interpolate( const COM::Attribute *src,
536  COM::Attribute *trg) {
537  COM_assertion_msg( validate_object()==0, "Invalid object");
538 
539  RFC_assertion( trg->is_nodal() && src->is_nodal());
540 
541  transfer< Nodal_data_const, Nodal_data, false>
542  ( src, trg, 1.);
543 }
544 
545 // Transfer data from a window to another using load transfer.
546 void Rocface::
547 load_transfer( const COM::Attribute *src,
548  COM::Attribute *trg,
549  const Real *_a, // Alpha for geometry interpolation
550  const int *_o) // Order of integration
551 {
552  RFC_assertion( trg->is_nodal() && src->is_nodal());
553 
554  const Real alpha = (_a == NULL)?-1.:*_a; // Alpha for geometry interpolation
555  const int order = (_o == NULL)?1:*_o; // Order of integration
556 
557  if ( src->is_nodal()) {
558  transfer<Nodal_data_const, Nodal_data, true>
559  ( src, trg, alpha, order, NULL, NULL, true);
560  }
561  else {
562  transfer<Facial_data_const, Nodal_data, true>
563  ( src, trg, alpha, order, NULL, NULL, true);
564  }
565 }
566 
567 // Register the public functions of the component to Roccom.
568 void Rocface::init(const std::string &mname) {
569 
570  Rocface *rfc = new Rocface( mname);
571 
572  COM_Type types[8];
573  std::string glb=mname+".global";
574 
575  COM_new_window( mname.c_str());
576  COM_new_attribute( glb.c_str(), 'w', COM_VOID, 1, "");
577  COM_set_object( glb.c_str(), 0, rfc);
578 
579  types[0] = COM_RAWDATA;
580  types[1] = types[2] = COM_METADATA;
581  types[3] = COM_MPI_COMM;
582  types[4] = COM_STRING;
583 
584  COM_set_member_function( (mname+".overlay").c_str(),
585  (Member_func_ptr)(&Rocface::overlay),
586  glb.c_str(), "biiII", types);
587 
588  types[4] = types[5] = types[6] = COM_STRING;
589  COM_set_member_function( (mname+".read_overlay").c_str(),
590  (Member_func_ptr)(&Rocface::read_overlay),
591  glb.c_str(), "biiiIII", types);
592 
593  types[3] = types[1] = types[2] = COM_METADATA;
594  COM_set_member_function( (mname+".set_tags").c_str(),
595  (Member_func_ptr)(&Rocface::set_tags),
596  glb.c_str(), "biii", types);
597 
598  types[3] = types[5] = COM_DOUBLE;
599  types[4] = types[6] = COM_INT;
600  COM_set_member_function( (mname+".least_squares_transfer").c_str(),
601  (Member_func_ptr)(&Rocface::least_squares_transfer),
602  glb.c_str(), "bioIIBB", types);
603 
604  COM_set_member_function( (mname+".interpolate").c_str(),
605  (Member_func_ptr)(&Rocface::interpolate),
606  glb.c_str(), "bio", types);
607 
608  types[4] = COM_INT;
609  COM_set_member_function( (mname+".load_transfer").c_str(),
610  (Member_func_ptr)(&Rocface::load_transfer),
611  glb.c_str(), "bioII", types);
612 
613 
614  types[3] = types[4] = types[5] = COM_STRING;
615  COM_set_member_function( (mname+".write_overlay").c_str(),
616  (Member_func_ptr)(&Rocface::write_overlay),
617  glb.c_str(), "biiIII", types);
618 
619  types[1] = types[2] = COM_STRING;
620  COM_set_member_function( (mname+".clear_overlay").c_str(),
621  (Member_func_ptr)(&Rocface::clear_overlay),
622  glb.c_str(), "bii", types);
623 
624  types[1] = COM_STRING;
625  COM_set_member_function( (mname+".read_control_file").c_str(),
626  (Member_func_ptr)(&Rocface::read_control_file),
627  glb.c_str(), "bi", types);
628 
629 
630  types[1] = COM_INT;
631  COM_set_member_function( (mname+".set_verbose").c_str(),
632  (Member_func_ptr)(&Rocface::set_verbose),
633  glb.c_str(), "bi", types);
634 
635  COM_window_init_done( mname.c_str());
636 }
637 
638 extern "C" void Rocin_load_module(const char *);
639 extern "C" void Rocin_unload_module(const char *);
640 
641 // Read Rocface control file.
642 void Rocface::
643 read_control_file( const char *fname) {
644  std::string ctrlname = _mname+"__CTRL";
645 
646  // Create a default window
647  COM_new_window(ctrlname.c_str());
648 
649  // Set verbosity level
650  COM_new_attribute( (ctrlname+".verbosity").c_str(), 'w', COM_INT, 1, "");
651  COM_set_array( (ctrlname+".verbosity").c_str(), 0, &_ctrl.verb);
652 
653  // Set snap threshold
654  COM_new_attribute( (ctrlname+".snap_tolerance").c_str(), 'w', COM_DOUBLE, 1, "");
655  COM_set_array( (ctrlname+".snap_tolerance").c_str(), 0, &_ctrl.snap);
656 
657  // Done initialization.
658  COM_window_init_done( ctrlname.c_str());
659 
660  // Read in using Rocin.
661  Rocin_load_module( "RFC_CNTRL_IN");
662  int hdl_read = COM_get_function_handle( "RFC_CNTRL_IN.read_parameter_file");
663  COM_call_function( hdl_read, fname, ctrlname.c_str());
664  Rocin_unload_module( "RFC_CNTRL_IN");
665 
666  COM_delete_window( ctrlname.c_str());
667 }
668 
669 // Deregister the component from Roccom.
670 void Rocface::finalize( const std::string &mname) {
671 
672  Rocface *rfc;
673 
674  std::string glb=mname+".global";
675  COM_get_object( glb.c_str(), 0, &rfc);
676 
677  delete rfc;
678  COM_delete_window( mname.c_str());
679 }
680 
682 
684 
685 // C/C++ binding
686 extern "C" void Rocface_load_module( const char *name)
687 { Rocface::init( std::string(name)); }
688 extern "C" void Rocface_unload_module( const char *name)
689 { Rocface::finalize( std::string(name)); }
690 
691 // Fortran binding
692 extern "C" void rocface_load_module( const char *name, long int length)
693 { Rocface::init( std::string(name, length)); }
694 extern "C" void rocface_unload_module( const char *name, long int length)
695 { Rocface::finalize( std::string(name, length)); }
696 
697 extern "C" void ROCFACE_LOAD_MODULE( const char *name, long int length)
698 { Rocface::init( std::string(name, length)); }
699 extern "C" void ROCFACE_UNLOAD_MODULE( const char *name, long int length)
700 { Rocface::finalize( std::string(name, length)); }
701 
702 extern "C" void rocface_load_module_( const char *name, long int length)
703 { Rocface::init( std::string(name, length)); }
704 extern "C" void rocface_unload_module_( const char *name, long int length)
705 { Rocface::finalize( std::string(name, length)); }
706 
707 extern "C" void ROCFACE_LOAD_MODULE_( const char *name, long int length)
708 { Rocface::init( std::string(name, length)); }
709 extern "C" void ROCFACE_UNLOAD_MODULE_( const char *name, long int length)
710 { Rocface::finalize( std::string(name, length)); }
711 
712 
713 
714 
715 
716 
std::string name() const
The name of the window.
void transfer(const Nodal_data_const &sf, Nodal_data &tf, const Real alpha, Real *t, int *iter, int doa, bool ver)
The main entry to the data transfer algorithm.
Definition: Transfer_2n.C:456
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void Rocin_load_module(const char *name)
Load the module Rocin into Roccom using the given module name.
Definition: Rocin.C:3063
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_WORLD
void transfer(const Nodal_data_const &sv, Facial_data &tf, const Real alpha, int doa=0, bool verb=false)
The main entry to the data transfer algorithm.
Definition: Transfer_2f.C:203
void rocface_load_module(const char *name, long int length)
Definition: Rocface.C:692
Specialization for transfering from faces to nodes.
Definition: Transfer_2n.h:77
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94
Specialization for transfering from nodes to nodes.
Definition: Transfer_2n.h:42
void rocface_unload_module_(const char *name, long int length)
Definition: Rocface.C:704
#define COM_assertion_msg(EX, msg)
void rocface_load_module_(const char *name, long int length)
Definition: Rocface.C:702
Defines the interface. Implementations only present in specializations.
Definition: Rocface.C:300
double Real
Definition: mapbasic.h:322
void COM_set_object(const char *wa_str, int pane_id, Type *addr)
Definition: roccom_c++.h:144
static void transfer(Transfer_type &trans, Facial_data_const &sf, Nodal_data &tf, const Real alpha, const int order, Real *tol, int *iter, const int verbose, const bool load)
See above.
Definition: Rocface.C:374
const Color GREEN
Definition: Color.C:59
void ROCFACE_LOAD_MODULE_(const char *name, long int length)
Definition: Rocface.C:707
static void transfer(Transfer_type &trans, Nodal_data_const &sf, Facial_data &tf, const Real alpha, const int order, Real *tol, int *iter, const int verbose, const bool)
Definition: Rocface.C:343
double length(Vector3D *const v, int n)
void COM_get_object(const char *wa_str, int pane_id, Type **addr)
Definition: roccom_c++.h:152
void ROCFACE_LOAD_MODULE(const char *name, long int length)
Definition: Rocface.C:697
#define RFC_END_NAME_SPACE
Definition: rfc_basic.h:29
void * Transfer_type
Definition: Rocface.C:302
static void transfer(Transfer_type &trans, Facial_data_const &sf, Facial_data &tf, const Real alpha, const int order, Real *tol, int *iter, const int verbose, const bool)
Definition: Rocface.C:358
static void transfer(Transfer_type &trans, Nodal_data_const &sf, Nodal_data &tf, const Real alpha, const int order, Real *tol, int *iter, const int verbose, const bool)
Definition: Rocface.C:328
Specialization for transfering nodal forces using Farhat&#39;s algorithm.
Definition: Transfer_2n.h:101
#define RFC_BEGIN_NAME_SPACE
Definition: rfc_basic.h:28
#define RFC_assertion_msg
Definition: rfc_basic.h:67
void Rocface_unload_module(const char *)
Definition: Rocface.C:688
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
#define USE_RFC_NAME_SPACE
Definition: rfc_basic.h:31
const Color BLUE
Definition: Color.C:62
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
void COM_set_array(const char *wa_str, int pane_id, void *addr, int strd=0, int cap=0)
Associates an array with an attribute for a specific pane.
Definition: roccom_c++.h:156
static void transfer(Transfer_type &trans, Source_type &sf, Target_type &tf, const Real alpha, const int order, Real *tol, int *iter, const int verbose, const bool load)
void Rocface_load_module(const char *)
Definition: Rocface.C:686
void rocface_unload_module(const char *name, long int length)
Definition: Rocface.C:694
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
Definition: roccom_c++.h:118
void COM_set_member_function(const char *wf_str, Member_func_ptr func, const char *wa_str, const char *intents, const COM_Type *types)
Definition: roccom_c++.h:330
void set_tolerance(double tol)
Definition: Overlay.C:66
static void transfer(Transfer_type &trans, Nodal_data_const &sf, Nodal_data &tf, const Real alpha, const int order, Real *tol, int *iter, const int verbose, const bool load)
Definition: Rocface.C:392
Specialization for transfering from faces to faces.
Definition: Transfer_2f.h:64
void ROCFACE_UNLOAD_MODULE_(const char *name, long int length)
Definition: Rocface.C:709
void transfer(const Facial_data_const &sf, Nodal_data &tf, const Real alpha, Real *tol, int *iter, int doa, bool verb)
The main entry to the data transfer algorithm.
Definition: Transfer_2n.C:463
Specialization for transfering from nodes to faces.
Definition: Transfer_2f.h:42
void comp_loads(const Facial_data_const &sf, Nodal_data &tf, const Real alpha, const int order, bool verb)
Compute the nodal load vector.
Definition: Transfer_2n.C:526
void transfer(const Nodal_data_const &sf, Nodal_data &tf, bool verb)
The main entry to the data transfer algorithm.
Definition: Transfer_2n.C:470
#define RFC_assertion
Definition: rfc_basic.h:65
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428
void read_control_file(const char *fname, Control_parameter &cp)
Definition: advectest.C:115
void transfer(const Facial_data_const &sf, Facial_data &tf, const Real alpha, int doa=0, bool verb=false)
The main entry to the data transfer algorithm.
Definition: Transfer_2f.C:209
void comp_loads(const Nodal_data_const &sf, Nodal_data &tf, const Real alpha, const int doa, bool verb)
Compute the nodal load vector.
Definition: Transfer_2n.C:519
void ROCFACE_UNLOAD_MODULE(const char *name, long int length)
Definition: Rocface.C:699
void Rocin_unload_module(const char *name)
Unload the module Rocin from Roccom.
Definition: Rocin.C:3066