huangxingxing преди 2 години
родител
ревизия
e19d0d4679

+ 25 - 13
src/main/java/com/miniframe/bisiness/system/AFT001Service.java

@@ -20,6 +20,7 @@ import com.miniframe.generate.business.system.model.AFT001BaseModel;
 import com.miniframe.model.system.*;
 import com.miniframe.model.system.dao.*;
 import com.miniframe.service.mq.CaeMQ;
+import com.miniframe.solverconfig.hcfd.HcfdPath;
 import com.miniframe.spring.mq.MFMqUtils;
 import com.miniframe.tools.XIFileUtils;
 import com.miniframe.tools.XiJsonUtil;
@@ -83,6 +84,7 @@ public class AFT001Service extends AFT001BaseModel implements ExecProcessFlow {
 					}
 					JSONObject obj  = new JSONObject();
 					obj.put("filePath",XIFileUtils.getRootPathStr()+ MFConstant.separator+file.getFilepath());
+//					obj.put("filePath","F:\\czm\\vtkfile\\tf.ugrid");
 					obj.put("fileType",modeling.getGridFileType().toLowerCase());
 					msg.setParamJson(obj.toString());
 				}
@@ -103,6 +105,7 @@ public class AFT001Service extends AFT001BaseModel implements ExecProcessFlow {
 					}
 					JSONObject obj  = new JSONObject();
 					obj.put("filePath",XIFileUtils.getRootPathStr()+ MFConstant.separator+file.getFilepath());
+//					obj.put("filePath","F:\\czm\\vtkfile\\f.vtk");
 					obj.put("fileType",modeling.getGridFileType().toLowerCase());
 					msg.setParamJson(obj.toString());
 				}
@@ -128,24 +131,33 @@ public class AFT001Service extends AFT001BaseModel implements ExecProcessFlow {
 
 		}else if(action.equals("ResultImport")){
 			if(solver.getSolverModel().equals("HCFDLab")) {
-				if (this.getA_aft001().getIsVolume() == "1") {
-					JSONObject obj = new JSONObject();
-					obj.put("filePath", "/cephfs/Postprocess_Binary");
-					obj.put("fileType", "binary");
-					obj.put("fileName", "whole_part1.plt,whole_part2.plt,whole_part3.plt");
-					msg.setParamJson(obj.toString());
-				} else {
-					JSONObject obj = new JSONObject();
-					obj.put("filePath", "/cephfs/Postprocess_Binary");
-					obj.put("fileType", "binary");
-					obj.put("fileName", "whole_part4.plt,whole_part5.plt,whole_part6.plt");
-					msg.setParamJson(obj.toString());
+				String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+proId;
+				String exePath = jobPath+ MFConstant.separator+"hcfd";
+				String testPath = exePath+ MFConstant.separator+"test";
+				String exeOutPath = testPath+ MFConstant.separator+"data_out";
+			 	List<File> fileList = HcfdPath.getStepFiles(proId, getA_aft001().getIsVolume(), step);
+			 	if(fileList.isEmpty()){
+					throw new BusinessException("EB4000017");
+				}
+			 	String fileName="";
+				for (int i = 0; i < fileList.size(); i++) {
+					if(i==fileList.size()-1){
+						fileName +=fileList.get(i).getName();
+					}else {
+						fileName +=fileList.get(i).getName()+",";
+					}
 				}
+				JSONObject obj = new JSONObject();
+				obj.put("filePath", exeOutPath);
+				obj.put("fileType", "ascii");
+				obj.put("fileName", fileName);
+				msg.setParamJson(obj.toString());
+
 			}else if(solver.getSolverModel().equals("FEMLab(结构力学)")){
 				String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+solver.getPid();
 				String exePath = jobPath+ MFConstant.separator+"fem";
 				String exeOutPath = exePath+ MFConstant.separator+"data_out";
-				File file = new File(exeOutPath+MFConstant.separator+"dynamicResponse-transient.vtk");
+					File file = new File(exeOutPath+MFConstant.separator+"dynamicResponse-transient.vtk");
 				if(!file.exists()){
 					throw new BusinessException("EB4000017");
 				}

+ 34 - 1
src/main/java/com/miniframe/solverconfig/hcfd/HcfdPath.java

@@ -20,9 +20,42 @@ import java.util.*;
  * 对执行所需要的文件进行文件夹规整已满足求解
  */
 public class HcfdPath {
+    /**
+     *
+     * @param pid
+     * @param isVolume 1 物面 2流场
+     * @param step  步数
+     * @return
+     */
+    public static List<File> getStepFiles(String pid ,String isVolume,String step) throws  BusinessException{
+        String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+pid;
+        String exePath = jobPath+ MFConstant.separator+"hcfd";
+        String testPath = exePath+ MFConstant.separator+"test";
+        String exeOutPath = testPath+ MFConstant.separator+"data_out";
+        File exeOutDir = new File(exeOutPath);
+        if(!exeOutDir.exists()){
+            throw  new BusinessException("EB4000017");
+        }
+        List<File> fileList =new ArrayList<>();
+        File[] files =exeOutDir.listFiles();
+        if(isVolume == "1") {//物面数据
+            for (File sonFile: files) {
+                if(sonFile.getName().indexOf("tec_volume_timestep"+step+".dat")>-1){//物面
+                    fileList.add(sonFile);
 
+                }
+            }
+        }else{//流场数据
+            for (File sonFile: files) {
+                if(sonFile.getName().indexOf("boundary_timestep"+step+".dat")>-1){//流场
+                    fileList.add(sonFile);
+                }
+            }
+        }
+        return  fileList;
+    }
 
-    public static List<Integer> hcfdTeps(String pid) throws  Exception{
+    public static List<Integer> hcfdTeps(String pid) throws  BusinessException{
         String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+pid;
         String exePath = jobPath+ MFConstant.separator+"hcfd";
         String testPath = exePath+ MFConstant.separator+"test";

+ 6 - 6
src/test/java/com/miniframe/FileMain.java

@@ -68,20 +68,20 @@ public class FileMain {
     }
 
     public static void main(String[] args) throws JsonProcessingException {
-//        String pathDir ="E:\\官网\\adicn";
-//        File file =new File(pathDir);
-//        allFiles(file);
+        String pathDir ="E:\\官网\\adicn";
+        File file =new File(pathDir);
+        allFiles(file);
 
 //        List<SliceMsg> b =new ArrayList<>();
 //        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));
+//        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\",\"" +