Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
DeformMeshRemap.cpp File Reference
#include "moab/Core.hpp"
#include "moab/Range.hpp"
#include "moab/Skinner.hpp"
#include "moab/LloydSmoother.hpp"
#include "moab/ProgOptions.hpp"
#include "moab/BoundBox.hpp"
#include "moab/SpatialLocator.hpp"
#include "MBTagConventions.hpp"
#include "DataCoupler.hpp"
#include <iostream>
#include <set>
#include <sstream>
#include <cassert>
+ Include dependency graph for DeformMeshRemap.cpp:

Go to the source code of this file.

Classes

class  DeformMeshRemap
 

Macros

#define MESH_DIR   "."
 

Functions

ErrorCode read_file (string &fname, EntityHandle &seth, Range &solids, Range &solid_elems, Range &fluids, Range &fluid_elems)
 
void deform_func (const BoundBox &bbox, double *xold, double *xnew)
 
ErrorCode deform_master (Range &fluid_elems, Range &solid_elems, Tag &xnew)
 
ErrorCode smooth_master (int dim, Tag xnew, EntityHandle &master, Range &fluids)
 
ErrorCode write_to_coords (Range &elems, Tag tagh)
 
int main (int argc, char **argv)
 

Variables

const int SOLID_SETNO = 100
 
const int FLUID_SETNO = 200
 
Interfacemb
 
const bool debug = true
 

Macro Definition Documentation

◆ MESH_DIR

#define MESH_DIR   "."
Examples
DeformMeshRemap.cpp.

Definition at line 36 of file DeformMeshRemap.cpp.

Function Documentation

◆ deform_func()

void deform_func ( const BoundBox bbox,
double *  xold,
double *  xnew 
)
Examples
DeformMeshRemap.cpp.

Definition at line 544 of file DeformMeshRemap.cpp.

545 {
546  /* Deformation function based on max delx and dely at top of rod
547  const double RODWIDTH = 0.2, RODHEIGHT = 0.5;
548  // function: origin is at middle base of rod, and is .5 high
549  // top of rod is (0,.55) on left and (.2,.6) on right
550  double delx = 0.5*RODWIDTH;
551 
552  double xfrac = (xold[0] + .5*RODWIDTH)/RODWIDTH, yfrac = xold[1]/RODHEIGHT;
553  xnew[0] = xold[0] + yfrac * delx;
554  xnew[1] = xold[1] + yfrac * (1.0 + xfrac) * 0.05;
555  */
556  /* Deformation function based on fraction of bounding box dimension in each direction */
557  double frac = 0.01; // taken from approximate relative deformation from LLNL Diablo of XX09 assys
558  CartVect *xo = reinterpret_cast< CartVect* >( xold ), *xn = reinterpret_cast< CartVect* >( xnew );
559  CartVect disp = frac * ( *xo - bbox.bMin );
560  *xn = *xo + disp;
561 }

References moab::BoundBox::bMin.

Referenced by DeformMeshRemap::deform_master().

◆ deform_master()

ErrorCode deform_master ( Range fluid_elems,
Range solid_elems,
Tag xnew 
)

◆ main()

int main ( int  argc,
char **  argv 
)
Examples
DeformMeshRemap.cpp.

Definition at line 427 of file DeformMeshRemap.cpp.

428 {
429  ErrorCode rval;
430 
431  ProgOptions po( "Deformed mesh options" );
432  po.addOpt< string >( "master,m", "Specify the master meshfile name" );
433  po.addOpt< string >( "worker,w", "Specify the slave/worker meshfile name, or 'none' (no quotes) if master only" );
434  po.addOpt< string >( "d1,", "Tag name for displacement x or xyz" );
435  po.addOpt< string >( "d2,", "Tag name for displacement y" );
436  po.addOpt< string >( "d3,", "Tag name for displacement z" );
437  po.addOpt< int >( "fm,", "Specify master fluid material set number(s). If none specified, "
438  "fluid sets derived from complement of solid sets." );
439  po.addOpt< int >( "fs,", "Specify master solid material set number(s). If none specified, "
440  "solid sets derived from complement of fluid sets." );
441  po.addOpt< int >( "sm,", "Specify slave fluid material set number(s). If none specified, fluid "
442  "sets derived from complement of solid sets." );
443  po.addOpt< int >( "ss,", "Specify slave solid material set number(s). If none specified, solid "
444  "sets derived from complement of fluid sets." );
445 
446  po.parseCommandLine( argc, argv );
447 
448  mb = new Core();
449 
450  DeformMeshRemap* dfr;
451 #ifdef USE_MPI
452  ParallelComm* pc = new ParallelComm( mb, MPI_COMM_WORLD );
453  dfr = new DeformMeshRemap( mb, pc );
454 #else
455  dfr = new DeformMeshRemap( mb );
456 #endif
457 
458  string masterf, slavef;
459  if( !po.getOpt( "master", &masterf ) ) masterf = string( MESH_DIR ) + string( "/rodquad.g" );
460  dfr->set_file_name( DeformMeshRemap::MASTER, masterf );
461 
462  if( !po.getOpt( "worker", &slavef ) ) slavef = string( MESH_DIR ) + string( "/rodtri.g" );
463  dfr->set_file_name( DeformMeshRemap::SLAVE, slavef );
464  if( slavef.empty() )
465  {
466  cerr << "Empty slave file name; if no slave, use filename 'none' (no quotes)." << endl;
467  return 1;
468  }
469 
470  vector< int > set_nos;
471  po.getOptAllArgs( "fm", set_nos );
472  for( vector< int >::iterator vit = set_nos.begin(); vit != set_nos.end(); ++vit )
474  set_nos.clear();
475 
476  po.getOptAllArgs( "fs", set_nos );
477  for( vector< int >::iterator vit = set_nos.begin(); vit != set_nos.end(); ++vit )
479  set_nos.clear();
480 
481  po.getOptAllArgs( "sm", set_nos );
482  for( vector< int >::iterator vit = set_nos.begin(); vit != set_nos.end(); ++vit )
484 
485  po.getOptAllArgs( "ss", set_nos );
486  for( vector< int >::iterator vit = set_nos.begin(); vit != set_nos.end(); ++vit )
488 
489  string tnames[3];
490  po.getOpt( "d1", &tnames[0] );
491  po.getOpt( "d2", &tnames[1] );
492  po.getOpt( "d3", &tnames[2] );
493  for( int i = 0; i < 3; i++ )
494  if( !tnames[i].empty() ) dfr->xdisp_name( tnames[i], i );
495 
496  rval = dfr->execute();
497 
498  delete dfr;
499  delete mb;
500 
501  return rval;
502 }

References DeformMeshRemap::add_set_no(), ProgOptions::addOpt(), ErrorCode, DeformMeshRemap::execute(), DeformMeshRemap::FLUID, ProgOptions::getOpt(), ProgOptions::getOptAllArgs(), DeformMeshRemap::MASTER, mb, MESH_DIR, ProgOptions::parseCommandLine(), DeformMeshRemap::set_file_name(), DeformMeshRemap::SLAVE, DeformMeshRemap::SOLID, and DeformMeshRemap::xdisp_name().

◆ read_file()

ErrorCode read_file ( string &  fname,
EntityHandle seth,
Range solids,
Range solid_elems,
Range fluids,
Range fluid_elems 
)

◆ smooth_master()

ErrorCode smooth_master ( int  dim,
Tag  xnew,
EntityHandle master,
Range fluids 
)

◆ write_to_coords()

ErrorCode write_to_coords ( Range elems,
Tag  tagh 
)

Variable Documentation

◆ debug

◆ FLUID_SETNO

const int FLUID_SETNO = 200
Examples
DeformMeshRemap.cpp.

Definition at line 50 of file DeformMeshRemap.cpp.

◆ mb

Interface* mb
Examples
DeformMeshRemap.cpp.

Definition at line 52 of file DeformMeshRemap.cpp.

Referenced by main().

◆ SOLID_SETNO

const int SOLID_SETNO = 100
Examples
DeformMeshRemap.cpp.

Definition at line 50 of file DeformMeshRemap.cpp.