Back to index

salome-med  6.5.0
Functions
testConvertPolygon.cxx File Reference
#include "MEDMEM_Mesh.hxx"

Go to the source code of this file.

Functions

int main ()

Function Documentation

int main ( void  )

Definition at line 30 of file testConvertPolygon.cxx.

{
  // Get file to convert.
  string file;
  // During 'make check' $srcdir exists
  if ( getenv("srcdir") ) {
    file = string( getenv("srcdir")) + "/../../resources/";
  }
  else if ( getenv( "MED_ROOT_DIR")) {
    // after installation
    file = string( getenv( "MED_ROOT_DIR" )) + "/share/salome/resources/med/";
  }
  else
  {
    return -1;
  }
  file += "BoxTetra2.med";
  cout << "File to cnvert: " << file << endl;
  // convertion
  MEDMEM::MESH *mesh=new MEDMEM::MESH(MEDMEM::MED_DRIVER, file.c_str(), "BoxTetra2");
  mesh->convertToPoly();

  // File to store conversion result
  if ( getenv("TMP") && access(getenv("TMP"),W_OK)==0 )
    file = getenv("TMP");
  else if ( getenv("TMPDIR") && access(getenv("TMPDIR"),W_OK)==0 )
    file = getenv("TMPDIR");
  else
    file = "/tmp";
  file += "/pointe_testConvertPolygon.med";

  int id=mesh->addDriver(MEDMEM::MED_DRIVER,file.c_str(),"mesh");
  mesh->write(id);
  mesh->removeReference();

  remove(file.c_str());

  return 0;
}