MOAB: Mesh Oriented datABase  (version 5.4.1)
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

Defines

#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

Define Documentation

#define MESH_DIR   "."

Definition at line 36 of file DeformMeshRemap.cpp.

Referenced by main().


Function Documentation

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

Definition at line 544 of file DeformMeshRemap.cpp.

References moab::BoundBox::bMin.

Referenced by DeformMeshRemap::deform_master().

{
    /*  Deformation function based on max delx and dely at top of rod
        const double RODWIDTH = 0.2, RODHEIGHT = 0.5;
        // function: origin is at middle base of rod, and is .5 high
        // top of rod is (0,.55) on left and (.2,.6) on right
      double delx = 0.5*RODWIDTH;

      double xfrac = (xold[0] + .5*RODWIDTH)/RODWIDTH, yfrac = xold[1]/RODHEIGHT;
      xnew[0] = xold[0] + yfrac * delx;
      xnew[1] = xold[1] + yfrac * (1.0 + xfrac) * 0.05;
    */
    /* Deformation function based on fraction of bounding box dimension in each direction */
    double frac  = 0.01;  // taken from approximate relative deformation from LLNL Diablo of XX09 assys
    CartVect *xo = reinterpret_cast< CartVect* >( xold ), *xn = reinterpret_cast< CartVect* >( xnew );
    CartVect disp = frac * ( *xo - bbox.bMin );
    *xn           = *xo + disp;
}
ErrorCode deform_master ( Range fluid_elems,
Range solid_elems,
Tag xnew 
)
int main ( int  argc,
char **  argv 
)

Definition at line 427 of file DeformMeshRemap.cpp.

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

{
    ErrorCode rval;

    ProgOptions po( "Deformed mesh options" );
    po.addOpt< string >( "master,m", "Specify the master meshfile name" );
    po.addOpt< string >( "worker,w", "Specify the slave/worker meshfile name, or 'none' (no quotes) if master only" );
    po.addOpt< string >( "d1,", "Tag name for displacement x or xyz" );
    po.addOpt< string >( "d2,", "Tag name for displacement y" );
    po.addOpt< string >( "d3,", "Tag name for displacement z" );
    po.addOpt< int >( "fm,", "Specify master fluid material set number(s). If none specified, "
                             "fluid sets derived from complement of solid sets." );
    po.addOpt< int >( "fs,", "Specify master solid material set number(s). If none specified, "
                             "solid sets derived from complement of fluid sets." );
    po.addOpt< int >( "sm,", "Specify slave fluid material set number(s). If none specified, fluid "
                             "sets derived from complement of solid sets." );
    po.addOpt< int >( "ss,", "Specify slave solid material set number(s). If none specified, solid "
                             "sets derived from complement of fluid sets." );

    po.parseCommandLine( argc, argv );

    mb = new Core();

    DeformMeshRemap* dfr;
#ifdef USE_MPI
    ParallelComm* pc = new ParallelComm( mb, MPI_COMM_WORLD );
    dfr              = new DeformMeshRemap( mb, pc );
#else
    dfr = new DeformMeshRemap( mb );
#endif

    string masterf, slavef;
    if( !po.getOpt( "master", &masterf ) ) masterf = string( MESH_DIR ) + string( "/rodquad.g" );
    dfr->set_file_name( DeformMeshRemap::MASTER, masterf );

    if( !po.getOpt( "worker", &slavef ) ) slavef = string( MESH_DIR ) + string( "/rodtri.g" );
    dfr->set_file_name( DeformMeshRemap::SLAVE, slavef );
    if( slavef.empty() )
    {
        cerr << "Empty slave file name; if no slave, use filename 'none' (no quotes)." << endl;
        return 1;
    }

    vector< int > set_nos;
    po.getOptAllArgs( "fm", set_nos );
    for( vector< int >::iterator vit = set_nos.begin(); vit != set_nos.end(); ++vit )
        dfr->add_set_no( DeformMeshRemap::MASTER, DeformMeshRemap::FLUID, *vit );
    set_nos.clear();

    po.getOptAllArgs( "fs", set_nos );
    for( vector< int >::iterator vit = set_nos.begin(); vit != set_nos.end(); ++vit )
        dfr->add_set_no( DeformMeshRemap::SLAVE, DeformMeshRemap::FLUID, *vit );
    set_nos.clear();

    po.getOptAllArgs( "sm", set_nos );
    for( vector< int >::iterator vit = set_nos.begin(); vit != set_nos.end(); ++vit )
        dfr->add_set_no( DeformMeshRemap::MASTER, DeformMeshRemap::SOLID, *vit );

    po.getOptAllArgs( "ss", set_nos );
    for( vector< int >::iterator vit = set_nos.begin(); vit != set_nos.end(); ++vit )
        dfr->add_set_no( DeformMeshRemap::SLAVE, DeformMeshRemap::SOLID, *vit );

    string tnames[3];
    po.getOpt( "d1", &tnames[0] );
    po.getOpt( "d2", &tnames[1] );
    po.getOpt( "d3", &tnames[2] );
    for( int i = 0; i < 3; i++ )
        if( !tnames[i].empty() ) dfr->xdisp_name( tnames[i], i );

    rval = dfr->execute();

    delete dfr;
    delete mb;

    return rval;
}
ErrorCode read_file ( string &  fname,
EntityHandle seth,
Range solids,
Range solid_elems,
Range fluids,
Range fluid_elems 
)
ErrorCode smooth_master ( int  dim,
Tag  xnew,
EntityHandle master,
Range fluids 
)
Examples:
DeformMeshRemap.cpp.
ErrorCode write_to_coords ( Range elems,
Tag  tagh 
)

Variable Documentation

const bool debug = true

Definition at line 54 of file DeformMeshRemap.cpp.

const int FLUID_SETNO = 200
Examples:
DeformMeshRemap.cpp.

Definition at line 50 of file DeformMeshRemap.cpp.

Definition at line 52 of file DeformMeshRemap.cpp.

const int SOLID_SETNO = 100
Examples:
DeformMeshRemap.cpp.

Definition at line 50 of file DeformMeshRemap.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines