// merge VTK files - each one will create a new surface:
Merge "File_1.vtk";
Merge "File_2_fix.vtk"; // original file contained triangles with bad ori
Merge "File_3.vtk";
Merge "File_4.vtk";
Merge "File_5.vtk";
Merge "File_6.vtk";
Merge "File_7.vtk";

// Remove duplicate mesh nodes (at the interface between patches):
Coherence Mesh;

// Cut surfaces to make sure they are parametrizable - this can be removed here
// because they are already, even if maybe a bit distorted:
//
// ClassifySurfaces{Pi, 1, 1};
//
// So instead we can just call
//
CreateTopology;
//
// to create the missing curves and points

// Create geometry for all curves and surfaces:
CreateGeometry;

// Define the volume (assuming there is no hole)
s() = Surface{:};
Surface Loop(1) = s();
Volume(1) = 1;

// Since we did not create any new surface, we can easily define physical groups
// (would need to inspect the result of ClassifySurfaces otherwise):
Physical Surface("inside", 1) = {1, 2};
Physical Surface("outside", 2) = {3};
Physical Surface("border", 3) = {4, 5, 6, 7};
Physical Volume("volume", 10) = {1};

// Set meshing constraints
uniform = 0;
If(uniform)
  Mesh.CharacteristicLengthMax = 2;
  Mesh.CharacteristicLengthMin = 2;
Else
  Mesh.CharacteristicLengthMax = 10;
  Mesh.CharacteristicLengthMin = 0.1;
  Mesh.CharacteristicLengthFromCurvature = 1;
  Mesh.MinimumElementsPerTwoPi = 20;
EndIf
Mesh.Algorithm3D = 10; // test new 3D algo
