Ejemplo n.º 1
0
 private static Map<String, Collection<BDiscretization>> buildMeshData(String xmlBoraDir)
     throws SAXException, IOException {
   BModel bModel = BModelReader.readObject(xmlBoraDir);
   Map<String, Collection<BDiscretization>> meshData =
       new HashMap<String, Collection<BDiscretization>>();
   for (BSubMesh subMesh : bModel.getSubMeshes()) {
     for (Constraint cons : subMesh.getConstraints()) {
       BDiscretization discr = cons.getGraphCell().getDiscretizationSubMesh(subMesh);
       if (discr == null) continue;
       String group = cons.getGroup();
       if (group == null) group = "DEFAULT_GROUP";
       Collection<BDiscretization> gDiscr = meshData.get(group);
       if (gDiscr == null) {
         gDiscr = new ArrayList<BDiscretization>();
         meshData.put(group, gDiscr);
       }
       gDiscr.add(discr);
     }
   }
   return meshData;
 }
Ejemplo n.º 2
0
 public static void main(String[] args) {
   try {
     org.jcae.mesh.bora.ds.BModel model = BModelReader.readObject(args[0], args[1]);
     BSubMesh s = model.getSubMeshes().iterator().next();
     BoraToUnvConvert conv = new BoraToUnvConvert(args[2], s);
     TIntArrayList listOfFaces = new TIntArrayList();
     for (java.util.Iterator<BCADGraphCell> its =
             model.getGraph().getRootCell().shapesExplorer(CADShapeEnum.EDGE);
         its.hasNext(); ) {
       BCADGraphCell cell = its.next();
       BDiscretization d = cell.getDiscretizationSubMesh(s);
       if (d != null) {
         listOfFaces.add(d.getId());
       }
     }
     for (java.util.Iterator<BCADGraphCell> its =
             model.getGraph().getRootCell().shapesExplorer(CADShapeEnum.FACE);
         its.hasNext(); ) {
       BCADGraphCell cell = its.next();
       BDiscretization d = cell.getDiscretizationSubMesh(s);
       if (d != null) {
         listOfFaces.add(d.getId());
       }
     }
     conv.collectBoundaryNodes(listOfFaces.toArray());
     conv.beforeProcessingAllShapes(false);
     int groupId = 0;
     for (int iFace : listOfFaces.toArray()) {
       groupId++;
       conv.processOneShape(groupId, "test" + groupId, iFace);
     }
     conv.afterProcessingAllShapes();
   } catch (SAXException ex) {
     LOGGER.log(Level.SEVERE, null, ex);
   } catch (IOException ex) {
     LOGGER.log(Level.SEVERE, null, ex);
   }
 }