MshFileVersion='4.1';
fprintf('--------------- demo04\n')
fprintf('3D meshing: mesh and partitioned mesh using ''MshFileVersion''=''%s''(default)\n',MshFileVersion)
fprintf('---------------\n')
geofile='cylinderkey';np=5;
fprintf('1. Building a mesh file by using :\n')
fprintf('   -> gmsh version %s\n',fc_oogmsh.gmsh.version())
fprintf('   -> geo file : %s\n',geofile);
meshfile=fc_oogmsh.gmsh.buildmesh3d(geofile,5,'verbose',2,'force',true,'MshFileVersion',MshFileVersion);
fprintf('   -> msh file : %s\n',fc_oogmsh.pathrep(meshfile));
fprintf('2. Reading mesh file\n')
Gh=fc_oogmsh.ooGmsh4(meshfile)
fprintf('3. Building partitioned mesh file\n')
fprintf('   -> number of partitions : %d\n',np);
pmfile=fc_oogmsh.gmsh.buildpartmesh3d(meshfile,np,'verbose',2,'force',true,'MshFileVersion',MshFileVersion);
fprintf('   -> partitioned msh file : %s\n',fc_oogmsh.pathrep(pmfile));
fprintf('4. Reading the partitioned mesh file\n')
pGh=fc_oogmsh.ooGmsh4(pmfile)

if fc_oogmsh.isgraphics()
  Gh.plotPhysicalElements()
  Gh.plotElementaryElements()

  pGh.plotPhysicalElements()
  pGh.plotElementaryElements()
  pGh.plotPartitionElements()
  pGh.plotInterfaceElements()
end
--------------- demo04
3D meshing: mesh and partitioned mesh using 'MshFileVersion'='4.1'(default)
---------------
1. Building a mesh file by using :
   -> gmsh version 4.5.1
   -> geo file : cylinderkey
[fc-oogmsh] Input file : <fc-oogmsh>/geodir/3d/cylinderkey.geo
[fc-oogmsh] Overwritting mesh file <fc-oogmsh>/meshes/cylinderkey-5.msh
[fc-oogmsh] Starting building mesh <fc-oogmsh>/meshes/cylinderkey-5.msh with gmsh 4.5.1
[fc-oogmsh]  Using command : gmsh -3 -setnumber N 5 -string "Mesh.MshFileVersion=4.1;"   <fc-oogmsh>/geodir/3d/cylinderkey.geo -o <fc-oogmsh>/meshes/cylinderkey-5.msh
 Be patient...
[fc-oogmsh] Using gmsh 4.5.1 to write MSH file format version 4.1 in <fc-oogmsh>/meshes/cylinderkey-5.msh
   -> msh file : <fc-oogmsh>/meshes/cylinderkey-5.msh
2. Reading mesh file

Gh = 

  fc_oogmsh.ooGmsh4 with properties:
                      q: (3x1167 double)
                     nq: 1167 double
                    dim: 3 double
                      d: 3 double
               toGlobal: (1x1167 double)
               meshfile: (1x73 char)
       partitionnedfile: 0 logical
             MeshFormat: (1x1 struct)
          PhysicalNames: []
               Entities: (1x1 struct)
    PartitionedEntities: []
                  Nodes: (1x1 struct)
               Elements: (1x1 struct)
          PeriodicLinks: []
                   Info: (1x1 struct)
                 orders: 1 double
3. Building partitioned mesh file
   -> number of partitions : 5
[fc-oogmsh] Input file : <fc-oogmsh>/meshes/cylinderkey-5.msh
[fc-oogmsh] Overwritting mesh file <fc-oogmsh>/meshes/cylinderkey-5-part5.msh
[fc-oogmsh] Starting building mesh <fc-oogmsh>/meshes/cylinderkey-5-part5.msh with gmsh 4.5.1
[fc-oogmsh]  Using command : gmsh -3 -part 5  -string "Mesh.MshFileVersion=4.1;"   -saveall  <fc-oogmsh>/meshes/cylinderkey-5.msh -o <fc-oogmsh>/meshes/cylinderkey-5-part5.msh
 Be patient...
[fc-oogmsh] Using gmsh 4.5.1 to write MSH file format version 4.1 in <fc-oogmsh>/meshes/cylinderkey-5-part5.msh
   -> partitioned msh file : <fc-oogmsh>/meshes/cylinderkey-5-part5.msh
4. Reading the partitioned mesh file

pGh = 

  fc_oogmsh.ooGmsh4 with properties:
                      q: (3x1180 double)
                     nq: 1180 double
                    dim: 3 double
                      d: 3 double
               toGlobal: (1x1180 double)
               meshfile: (1x79 char)
       partitionnedfile: 1 logical
             MeshFormat: (1x1 struct)
          PhysicalNames: []
               Entities: (1x1 struct)
    PartitionedEntities: (1x1 struct)
                  Nodes: (1x1 struct)
               Elements: (1x1 struct)
          PeriodicLinks: []
                   Info: (1x1 struct)
                 orders: 1 double