public static function init($config_file)
 {
     parent::init($config_file);
     self::$instance->templatePath = realpath(self::$instance->templatePath);
     self::register(self::$instance);
     //var_dump(self::$instance);
 }
 public static function init($file)
 {
     parent::init($file);
     $obj = json_decode(json_encode(self::$instance), true);
     self::$manuals = new \stdClass();
     self::convertToManual($obj, null);
     //echo json_encode(self::$manuals, JSON_PRETTY_PRINT);
     self::register(self::$manuals);
 }
Beispiel #3
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.'];
     }
 }
 public function action_setGlobal()
 {
     $path = \GLOBALVAR\USERDEPO_PATH . "/" . SessionService::getInstance()->get('userName') . "/" . SessionService::getInstance()->get('modelName');
     $mssubmit = new GlobalConf();
     $mssubmit->initFromForm($this->post);
     $record = $mssubmit->printConf();
     $mssubmit->cleanConfig($path . ConfFile::$configFile['global']);
     if ($mssubmit->saveConfig($path . ConfFile::$configFile['global'], $record, FILE_APPEND)) {
         $this->msg = 'configuration was saved successfully';
     }
     $dd = new DDadaptConf();
     $dd->initFromForm($this->post);
     $recordDD = $dd->printConf();
     $dd->cleanConfig($path . ConfFile::$configFile['ddCoarse']);
     if ($mssubmit->saveConfig($path . ConfFile::$configFile['ddCoarse'], $recordDD, FILE_APPEND)) {
         $this->msg = 'configuration was saved successfully';
     }
     return [];
 }