Back to index

salome-med  6.5.0
Functions
test_copie_family.cxx File Reference
#include <string>
#include <math.h>
#include <stdlib.h>
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_Family.hxx"
#include "MEDMEM_Group.hxx"
#include "MEDMEM_MedMeshDriver.hxx"
#include "MEDMEM_MedFieldDriver.hxx"
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"

Go to the source code of this file.

Functions

static void affiche_support (const SUPPORT *mySupport)
static void affiche_famille (const FAMILY *myFamily)
int main (int argc, char **argv)

Function Documentation

static void affiche_famille ( const FAMILY *  myFamily) [static]

Definition at line 68 of file test_copie_family.cxx.

{
  affiche_support(myFamily);
  cout << "  - Identifier : "<<myFamily->getIdentifier()<<endl ;
  int NumberOfAttributes = myFamily->getNumberOfAttributes() ;
  cout << "  - Attributes ("<<NumberOfAttributes<<") :"<<endl;
  for (int j=1;j<NumberOfAttributes+1;j++)
    cout << "    * "<<myFamily->getAttributeIdentifier(j)<<" : "<<myFamily->getAttributeValue(j)<<", "<<myFamily->getAttributeDescription(j).c_str()<<endl ;
  int NumberOfGroups = myFamily->getNumberOfGroups() ;
  cout << "  - Groups ("<<NumberOfGroups<<") :"<<endl;
  for (int j=1;j<NumberOfGroups+1;j++)
    cout << "    * "<<myFamily->getGroupName(j).c_str()<<endl ;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void affiche_support ( const SUPPORT *  mySupport) [static]

Definition at line 42 of file test_copie_family.cxx.

{
  cout << "  - Name : "<<mySupport->getName().c_str()<<endl ;
  cout << "  - Description : "<<mySupport->getDescription().c_str()<<endl ;
  cout << "  - Entity : "<<mySupport->getEntity()<<endl ;
  cout << "  - Entities list : "<<endl ;
  if (!(mySupport->isOnAllElements())) 
    {
      int NumberOfTypes = mySupport->getNumberOfTypes() ;
      cout<<"  - NumberOfTypes : "<<NumberOfTypes<<endl;
      const medGeometryElement * Types = mySupport->getTypes() ;
      for (int j=0;j<NumberOfTypes;j++) 
        {
          cout<<"    * Type "<<Types[j]<<" : ";
          int NumberOfElements = mySupport->getNumberOfElements(Types[j]) ;
          const int * Number = mySupport->getNumber(Types[j]) ;
          for (int k=0; k<NumberOfElements;k++)
            cout << Number[k] << " ";
          cout << endl ;
        }
    }
  else
    cout << "    Is on all entities !"<< endl;
}

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 82 of file test_copie_family.cxx.

{
  if (argc <3) 
    { // after 3, ignored !
      cerr << "Usage : " << argv[0] 
           << " filename meshname" << endl << endl;
      exit(-1);
    }

  string filename = argv[1] ;
  string meshname = argv[2] ;

  MESH * myMesh= new MESH;
  myMesh->setName(meshname);
  MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
  myMeshDriver.setMeshName(meshname);
  myMeshDriver.open() ;
  myMeshDriver.read() ;
  myMeshDriver.close() ;

  if ( myMesh->getNumberOfFamilies(MED_NODE) < 1 )
    {
      cerr << "No nodal families in the file" << endl;
      return 1;
    }
  const FAMILY * myFamily = myMesh->getFamily(MED_NODE,1);

  cout << "Show Family :"<<endl ;
  affiche_famille(myFamily);
  FAMILY * myFamily2 = new FAMILY(* myFamily);
  //delete myFamily;
  cout << "Show Family2 :"<<endl ;
  affiche_famille(myFamily2);
  FAMILY * myFamily3 = new FAMILY(* myFamily2);
  myFamily2->removeReference();
  cout << "Show Family3 :"<<endl ;
  affiche_famille(myFamily3);
  myFamily3->removeReference();

  cout << "That's all"<<endl ;

  myMesh->removeReference();

  return 0;
}

Here is the call graph for this function: