huangxingxing 2 lat temu
rodzic
commit
4fd8b0550b

+ 9 - 7
src/main/java/com/miniframe/bisiness/system/AFT001Service.java

@@ -221,19 +221,21 @@ public class AFT001Service extends AFT001BaseModel implements ExecProcessFlow {
 				String u=this.getA_aft001().getDataU();
 				String v=this.getA_aft001().getDataV();
 				String w=this.getA_aft001().getDataW();
-				if(StringUtil.isNullOrEmpty(x)
-						||StringUtil.isNullOrEmpty(y)
-						||StringUtil.isNullOrEmpty(z)
-						||StringUtil.isNullOrEmpty(w)
+				if(
+//						StringUtil.isNullOrEmpty(x)
+//						||StringUtil.isNullOrEmpty(y)
+//						||StringUtil.isNullOrEmpty(z)
+//						||
+				StringUtil.isNullOrEmpty(w)
 						||StringUtil.isNullOrEmpty(u)
 						||StringUtil.isNullOrEmpty(v)
 				){
 					throw new BusinessException("EB4000016");
 				}
 				JSONObject obj  = new JSONObject();
-				obj.put("x",x);
-				obj.put("y",y);
-				obj.put("z",z);
+//				obj.put("x",x);
+//				obj.put("y",y);
+//				obj.put("z",z);
 				obj.put("u",u);
 				obj.put("v",v);
 				obj.put("w",w);

+ 26 - 4
src/main/java/com/miniframe/solverconfig/fem/VTK.java

@@ -38,8 +38,10 @@ public class VTK {
             String line;
             Integer nele =0;
             Integer neln =0;
-
-
+            /**
+             * 最小grid
+             */
+            Integer minGIndex =1;
 
 
             while((line=bfreader.readLine())!=null) {//包含该行内容的字符串,不包含任何行终止符,如果已到达流末尾,则返回 null
@@ -50,6 +52,7 @@ public class VTK {
                  if(line.indexOf("CROD")>-1){
                     ArrayList<Integer> tmp=patInts(line);
                     ArrayList<Integer> cellst =new ArrayList<>();
+
                     cellst.add(tmp.get(2)-1);
                     cellst.add(tmp.get(3)-1);
                     cells.add(cellst);
@@ -517,22 +520,27 @@ public class VTK {
                 // 第4列表示节点的Y坐标;
                 // 第5列表示节点的Z坐标;
                 else if(line.indexOf("GRID*")>-1){
+
                     ArrayList<Float> pointst =new ArrayList<>();
                     ArrayList<Float> tmp=patFloats2(line);
                     String line2=bfreader.readLine();
                     ArrayList<Float> tmp2=patFloats2(line2);
+
                     pointst.add(tmp.get(1));
                     pointst.add(tmp.get(2));
                     pointst.add(tmp2.get(0));
+                    pointst.add(tmp.get(0));//代号
                     points.add(pointst);
 
                 }
                 else if(line.indexOf("GRID")>-1){
                     ArrayList<Float> pointst =new ArrayList<>();
                     ArrayList<Float> tmp=patFloats(line);
+
                     pointst.add(tmp.get(1));
                     pointst.add(tmp.get(2));
                     pointst.add(tmp.get(3));
+                    pointst.add(tmp.get(0));//代号
                     points.add(pointst);
                 }
 
@@ -556,7 +564,7 @@ public class VTK {
             writer.write("\r\n");//换行
 
             for (ArrayList<Float> point:points) {
-                for (int i = 0; i <point.size() ; i++) {
+                for (int i = 0; i <point.size()-1 ; i++) {
                     writer.write(blanks(5));
                     writer.write(fixedFloat(point.get(i)));
                 }
@@ -575,7 +583,8 @@ public class VTK {
                 writer.write(fixedString(8,String.valueOf(cell.size())));
                 writer.write(blanks(2));
                 for (int i = 0; i <cell.size() ; i++) {
-                        writer.write(fixedString(8,String.valueOf(cell.get(i))));
+                    Integer newIndex = findNewGridIndex(points, cell.get(i)+1);
+                    writer.write(fixedString(8,newIndex.toString()));
                 }
                 writer.write("\r\n");//换行
             }
@@ -625,6 +634,16 @@ public class VTK {
         return vtkFile.getPath();
     }
 
+    private static Integer findNewGridIndex(ArrayList<ArrayList<Float>> points, int oldeIndex) {
+       int i=0;
+        for (ArrayList<Float> point: points) {
+            if(point.get(3)==oldeIndex){
+                return i;
+            }
+            i++;
+        }
+        return 0;
+    }
 
 
     public static ArrayList<Integer> patInts(String line){
@@ -729,6 +748,9 @@ public class VTK {
         return t;
     }
     public static void main(String[] args) {
+        File f =new File("D:\\FEMLab\\ADI.SimWork4.0\\FEMLab\\data\\static analysis\\1.09_geartooth-static.bdf");
+        VTK.CreateVTKFile(f,"f");
+
 //        String ling ="                4.000000000000                0.500000000000               -0.500000000000";
 //        System.out.println(ling.length());
 //        System.out.println(String.format("%25.12f",1.51597));

+ 17 - 2
src/test/java/com/miniframe/FileMain.java

@@ -76,12 +76,27 @@ public class FileMain {
 //        for (int i = 1; i <3 ; i++) {
 //            b.add( inib(i));
 //        }
-
+//
 //        String t= XiJsonUtil.objectToJson(b);
 //        System.out.println(t);
-
+//
         StreamMsg b =inic();
         System.out.println(XiJsonUtil.objectToJson(b));
+//String  f ="[{\"index\":1,\"type\":\"contour\",\"variableName\":\"P\",\"level\":10,\"normal_x\":12.0,\"normal_y\":2.0,\"normal_z\":3.0,\"position_x\":0.35,\"position_y\":0.25,\"position_z\":0.22,\"scalar_value_state\":true,\"solid_state\":true,\"" +
+//        "sectional_plane_state\":true,\"sectional_contour_state\":true,\"xrange\":null,\"yrange\":null,\"zrange\":null,\"areaRange\":null},{\"index\":2,\"type\":\"contour\",\"variableName\":\"P\",\"level\":10,\"normal_x\":12.0,\"normal_y\":2.0,\"normal_z\":3.0,\"position_x\":0.35,\"position_y\":0.25,\"position_z\":0.22,\"scalar_value_state\":true,\"solid_state\":true,\"sectional_plane_state\":true,\"sectional_contour_state\":true,\"xrange\":null,\"yrange\":null,\"zrange\":null,\"areaRange\":null}]";
+//        String  t = "[{\"index\":\"1\",\"type\":\"line\",\"" +
+//                "variableName\":\"r\",\"level\":1," +
+//                "\"normal_x\":\"\",\"normal_y\":\"\",\"normal_z\":\"\"," +
+//                "\"position_x\":\"1\",\"position_y\":\"\",\"position_z\":\"\"," +
+//                "\"scalar_value_state\":false," +
+//                "\"solid_state\":true," +
+//                "\"sectional_pLane_state\":true," +
+//                "\"sectional_contour_state\":true,\"areaRange\":\"\"}" +
+//                "" +
+//
+//                "]";
+//        List<SliceMsg> list = XiJsonUtil.jsonToList(t,SliceMsg.class);
+
     }
 
     private static SliceMsg inib(int id) {