moab
addfield.cpp File Reference
#include <iostream>
#include "moab/Core.hpp"
#include <math.h>
#include <cstdlib>
#include <assert.h>

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::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 85 of file addfield.cpp.

                               {

  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);

  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