Browse Source

hcfd step

huangxingxing 2 năm trước cách đây
mục cha
commit
c47fb553dc

+ 12 - 1
src/main/java/com/miniframe/bisiness/system/AFT002Service.java

@@ -1,8 +1,11 @@
 package com.miniframe.bisiness.system;
 
+import java.util.List;
 import java.util.Map;
 import com.miniframe.core.ExecProcessFlow;
 import com.miniframe.generate.business.system.model.AFT002BaseModel;
+import com.miniframe.solverconfig.hcfd.HcfdExe;
+import com.miniframe.solverconfig.hcfd.HcfdPath;
 
 /**
  * 基础系统,“获取步数”逻辑处理(重新生成不覆盖)。
@@ -19,7 +22,15 @@ public class AFT002Service extends AFT002BaseModel implements ExecProcessFlow {
 		String usrId =this.getA_systemhead().getUserId();
 		String solverConfigId =getA_aft002().getSolverConfigId();
 		String proId =getA_aft002().getPid();
-		String steps ="10,20,30,40";
+		List<Integer> steplist = HcfdPath.hcfdTeps(proId);
+		String steps ="";
+		for (int i = 0; i < steplist.size(); i++) {
+			if(i==steplist.size()-1){
+				steps+=steplist.get(i);
+			}else{
+				steps+=steplist.get(i)+",";
+			}
+		}
 		this.getD_aft002().setSteps(steps);
 	}
 	

+ 29 - 0
src/main/java/com/miniframe/solverconfig/hcfd/HcfdPath.java

@@ -1,6 +1,7 @@
 package com.miniframe.solverconfig.hcfd;
 
 import com.miniframe.constant.MFConstant;
+import com.miniframe.core.exception.BusinessException;
 import com.miniframe.core.ext.UtilTools;
 import com.miniframe.model.system.*;
 import com.miniframe.model.system.dao.SysFileMapper;
@@ -13,12 +14,35 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
+import java.util.*;
 
 /**
  * 对执行所需要的文件进行文件夹规整已满足求解
  */
 public class HcfdPath {
 
+
+    public static List<Integer> hcfdTeps(String pid) throws  Exception{
+        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<Integer> steps = new ArrayList<>();
+        File[] files =exeOutDir.listFiles();
+        for (File sonFile: files) {
+            if(sonFile.getName().indexOf("hcfd_tec_boundary_timestep")>0){
+                String stip=sonFile.getName().replace("hcfd_tec_boundary_timestep","").replace(".dat","");
+                steps.add(Integer.valueOf(stip));
+            }
+        }
+        Collections.sort(steps);
+        return steps;
+    }
+
     public static  void hcfdCreatPath(AdiModeling modeling,
                                       AdiSolverConfig config,
                                       AdiSolverJob job ) throws IOException {
@@ -63,4 +87,9 @@ public class HcfdPath {
     }
 
 
+    public static void main(String[] args) {
+        String stip="hcfd_tec_boundary_timestep100.dat".replace("hcfd_tec_boundary_timestep","").replace(".dat","");
+        System.out.println(stip);
+    }
+
 }