Back to index

salome-med  6.5.0
Functions
MEDSPLITTER_API.cxx File Reference
#include "MEDSPLITTER_API.hxx"
#include <string>
#include "MEDMEM_define.hxx"
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_Family.hxx"
#include "MEDSPLITTER_Graph.hxx"
#include "MEDSPLITTER_MESHCollection.hxx"
#include "MEDSPLITTER_Topology.hxx"
#include "MEDSPLITTER_ParaDomainSelector.hxx"

Go to the source code of this file.

Functions

int medsplitter (const char *inputfilename, const char *mesh, const char *outputfilename, int is_distributed, int nbdomains, int method, int meshonly, int plainmaster, int createboundaryfaces, int familysplitting, int emptygroups)
 MEDSPLITTER high-level API.
int medsplitter_para (const char *inputfilename, const char *outputfilename, const int nprocs, const int method, const bool create_boundary_faces, const bool family_splitting)
 Parallel MEDSPLITTER high-level API.

Function Documentation

int medsplitter ( const char *  inputfilename,
const char *  mesh,
const char *  outputfilename,
int  is_distributed,
int  nbdomains,
int  method,
int  meshonly,
int  plainmaster,
int  createboundaryfaces,
int  familysplitting,
int  emptygroups 
)

MEDSPLITTER high-level API.

Parameters:
inputfilenamename of the input file
meshname of the input mesh (only used for the sequential input file case)
outputfilenamename out the master output file
is_distributedsequential input (0) or distributed input (1)
nbdomainsnumber of subdomains
methodMETIS(0) or SCOTCH(1)
meshonlyprojects mesh and fields (0) or only the mesh (1)
plainmastercreates a plain masterfile (1) instead of an XML file (0),
createboundaryfacescreates the necessary faces so that face joints are created
familysplittingpreserves the family names (1) instead of focusing on the groups (0)
emptygroupscreates empty groups in zones that do not contain a group from the original domain

Definition at line 56 of file MEDSPLITTER_API.cxx.

{                        

  //Pointer to the initial collection
  MEDSPLITTER::MESHCollection* collection; 

  // Loading the mesh collection
  string input(inputfilename);

  if (is_distributed ==0)
  {
    string meshname (mesh);
    collection=new MEDSPLITTER::MESHCollection(input,meshname);
  }
  else
    collection = new MEDSPLITTER::MESHCollection(input);

  // Creating the graph and partitioning it
  MEDSPLITTER::Topology* new_topo;
  if (method==0)
    new_topo = collection->createPartition(nbdomains,MEDSPLITTER::Graph::METIS);
  else
    new_topo = collection->createPartition(nbdomains,MEDSPLITTER::Graph::SCOTCH);
  
  // Creating a new mesh collection from the partitioning 
  MEDSPLITTER::MESHCollection new_collection(*collection, new_topo, familysplitting, emptygroups);
 
  //Writing the output files (master + MED files)
  if (plainmaster)
    new_collection.setDriverType(MEDSPLITTER::MedAscii);
  new_collection.setSubdomainBoundaryCreates(createboundaryfaces);
  string output(outputfilename);
  new_collection.write(output);

  // Casting the fields on the new collection
  if (meshonly!=0)
    new_collection.castAllFields(*collection);
  delete collection;

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int medsplitter_para ( const char *  inputfilename,
const char *  outputfilename,
const int  nprocs,
const int  method,
const bool  create_boundary_faces,
const bool  family_splitting 
)

Parallel MEDSPLITTER high-level API.

Parameters:
inputfilenamename of the input distributed MED file
outputfilenamename out the master output file
nprocsnumber of subdomains
methodMETIS(0) or SCOTCH(1)
create_boundary_facescreates the necessary faces so that faces joints are created in the output files
family_splittingpreserves the family names instead of focusing on the groups

Definition at line 120 of file MEDSPLITTER_API.cxx.

{
  // Parallelizer
  MEDSPLITTER::ParaDomainSelector parallelizer;

  // Loading the mesh collection
  MEDSPLITTER::MESHCollection collection (inputfilename, parallelizer);

  // Creating the graph and partitioning it   
  auto_ptr<MEDSPLITTER::Topology> new_topo;
  if (method==0)
    new_topo.reset( collection.createPartition(nprocs,MEDSPLITTER::Graph::METIS));
  else
    new_topo.reset( collection.createPartition(nprocs,MEDSPLITTER::Graph::SCOTCH));

  // Creating a new mesh collection from the partitioning 
  MEDSPLITTER::MESHCollection new_collection(collection, new_topo.get(),family_splitting);
  new_collection.setSubdomainBoundaryCreates(create_boundary_faces);

  //Writing the output files (master + MED files)
  string output(outputfilename);
  new_collection.write(output);

  return 0;
}

Here is the call graph for this function: