MOAB: Mesh Oriented datABase  (version 5.4.1)
addfield.cpp File Reference
#include <iostream>
#include "moab/Core.hpp"
#include <cmath>
#include <cstdlib>
#include <cassert>
+ Include dependency graph for addfield.cpp:

Go to the source code of this file.

Namespaces

namespace  moab
 

Class representing axis-aligned bounding box.


Functions

double moab::physField (double x, double y, double z, double factor)
void moab::putElementField (Interface *mbi, const char *tagname, double factor)
void moab::putSpectralElementField (Interface *mbi, int dim, int np, const char *tagname, double factor)
void moab::putVertexField (Interface *mbi, const char *tagname, double factor)
int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 130 of file addfield.cpp.

References ErrorCode, MB_SUCCESS, moab::putElementField(), moab::putSpectralElementField(), and moab::putVertexField().

{

    using namespace moab;

    Interface* mbi = new Core();

    if( argc < 3 )
    {
        cout << "Usage: " << argv[0] << " <infile> <outfile> [factor]\n"
             << "Writes both vertex and element fields.\n";
        return 0;
    }

    mbi->load_mesh( argv[1] );

    double factor = 1.0;
    if( argc == 4 ) factor = atof( argv[3] );

    putVertexField( mbi, "vertex_field", factor );
    putElementField( mbi, "element_field", factor );
    // putSpectralElementField(mbi, 2, 4, "spectral_element_field", factor);
    putSpectralElementField( mbi, 2, 4, "a2oTAG", factor );

    ErrorCode result = mbi->write_mesh( argv[2] );
    if( MB_SUCCESS == result )
        cout << "wrote " << argv[2] << endl;
    else
        cout << "Failed to write " << argv[2] << endl;

    //  vector<double> coords;
    //  mbi->get_vertex_coordinates(coords);
    //  double xavg = 0;
    //  for (int i = 0; i < coords.size()/3; i++) xavg += coords[i];
    //  cout << xavg << endl;

    return 1;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines