示例#1
0
 public function action_main()
 {
     $path = \GLOBALVAR\USERDEPO_PATH . "/" . SessionService::getInstance()->get('userName') . "/" . SessionService::getInstance()->get('modelName');
     $conf = new GlobalConf();
     $conf->initFromFile($path . ConfFile::$configFile['global']);
     $conf->initGlobal();
     SessionService::getInstance()->set('meshGen', $conf->meshGen);
     SessionService::getInstance()->set('dimension', $conf->dimension);
     $dd = new DDadaptConf();
     $dd->initFromFile($path . ConfFile::$configFile['ddCoarse']);
     $dd->initDDadapt();
     if ($this->requestService->isPost) {
         if (SessionService::getInstance()->get('dimension') == 1 && SessionService::getInstance()->get('meshGen') == 1) {
             URLService::redirect(\GLOBALVAR\ROOT . "/?core=mesh1d");
         } else {
             if (SessionService::getInstance()->get('dimension') == 2 && SessionService::getInstance()->get('meshGen') == 1) {
                 URLService::redirect(\GLOBALVAR\ROOT . "/?core=mesh2d");
             } else {
                 if (SessionService::getInstance()->get('dimension') == 2 && SessionService::getInstance()->get('meshGen') == 2) {
                     URLService::redirect(\GLOBALVAR\ROOT . "/?core=meshGen");
                 } else {
                     URLService::redirect(\GLOBALVAR\ROOT . "/?core=waterConf");
                 }
             }
         }
     }
     return ["conf" => $conf, "ddConf" => $dd];
 }
示例#2
0
 public function action_getOutputTime()
 {
     // structure of output file
     //** [1d]   [2d]    []
     //**  X      Y     value
     $this->STOP_PROPAGATION = true;
     $file = '/out/RE_matrix_' . $this->request['type'] . '-' . $this->request['val'] . '.dat';
     $res = outputData::getCont($this->dir . $file);
     if ($res) {
         $conf = new GlobalConf();
         $conf->initFromFile($this->dir . ConfFile::$configFile['global']);
         $conf->initGlobal();
         $dim = $conf->dimension;
         $Data = str_getcsv($res, "\n");
         $j = 0;
         $parseData = [];
         for ($k = 0; $k < count($Data); $k++) {
             $row = str_getcsv(trim($Data[$k]), " ");
             $parseData[$j] = array();
             for ($i = 0; $i < count($row); $i++) {
                 if (!empty($row[$i])) {
                     array_push($parseData[$j], $row[$i]);
                 }
             }
             $j++;
         }
         $resData = array();
         for ($l = 0; $l < count($parseData); $l++) {
             for ($k = 0; $k < count($parseData[$l]); $k++) {
                 $resData[$l][$k] = (double) $parseData[$l][$k];
                 $resData[$l][$k] = round($resData[$l][$k], 7);
             }
         }
         return ['res' => $resData, 'dim' => (int) $dim, 'success' => true];
     } else {
         return ['res' => [], 'success' => false, 'msg' => 'The output file not exist.'];
     }
 }