Mesh Oriented datABase  (version 5.6.0)
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 548 of file DeformMeshRemap.cpp.

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

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 432 of file DeformMeshRemap.cpp.

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

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.