-
Notifications
You must be signed in to change notification settings - Fork 0
/
nealbara_interface.d
128 lines (73 loc) · 3.25 KB
/
nealbara_interface.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**
This program is part of the nealbara suite, which is a free software:
you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
USES
====
This is the interface to invoke Nealbara.
The program (Nealbara) first reads
the workflow file, where
each stage, its corresponding function,
and its requirements are specified.
The next in reading queue are
the configuration file, and the grammar file,
supplied by command line arguments.
It then sends the configuration file,
as well as grammar file,
to the Niarbyl object.
We assume that the first step of the workflow is
to generate the world, otherwise similar procedure applies.
From the Niarbyl object,
the world commands will read off, then executed.
The process forks,
and the child starts the FORTRAN world generator,
and links it to two fifos before exiting itself.
The parent reads the world generator requierments,
which is basically a list of variables, then
uses the Niarbyl machine to find
these from the configuration file
and writes the world commands to one fifo,
as unformatted binary stream.
The world generator reads these unformatted data, and
returns its result, by writing it to the other fifo, then exits.
The parent reads the world, and saves it in its memory.
**/
/** imports **/
// tango
import tango.io.Stdout;
// phobos
import std.stdio, core.stdc.stdio, core.stdc.stdlib, std.string;
// niarbyl
import niarbylmachine, nealbara;
/** functions **/
/* main */
void main()
{
// setup
niarbylmachine.hierarchicalReader Reader = new niarbylmachine.hierarchicalReader(1, "stringarr", "string");
/* 1 : initiate 1D base set to construct fractal branching
stringarr : the content of each knot is a string array
string : the arc coordinates are given as strings, thus please deal as such
*/
Reader.initiate("workflow.conf"); // target set
Reader.readFile(); // read it out
Reader.readTarget(); // set it to a fractal arc
nealbara.nealbaramachine Nealbara = new nealbara.nealbaramachine("world.conf", "world.grmr");
// nealbara needs to know only the world and its reading grammar
Nealbara.parse_FractalArc_KnotContent!((niarbylmachine.arc!(string, string[]))[])(Reader.fractalSet_sym_1D.arcs);
//niarbylmachine.
// get the problem equation
// get the associated solver
// get the conditions using the data reader
// call the solver
// get results
// format them
// end of story
}