Math2mat
|
Public Member Functions | |
StructTreatment () | |
StructTreatment | copy () |
void | modifyNumType (NumType type) |
long | getParseTime () |
void | setTop (Function top) |
Function | getTop () |
Vector< Element > | getInput () |
Vector< Element > | getOutput () |
String | getName () |
void | parse (File file) throws ParsingException |
void | parseNoFlat (File file) throws ParsingException |
String | getSourceMd5 () |
String | getSourceCode () |
void | parse (String code) throws ParsingException |
Vector< Element > | createOp (Vector< Element > a, Vector< Element > b, Operation op) |
Vector< Element > | createNot (Vector< Element > a, Not not) |
int | getNextOpCpt () |
void | treeToVector () |
void | treeToVector (Function parent) |
Vector< Element > | createAff (Variable var, Vector< Element > expr) |
SimpleVariable | createInOut (String name) |
Vector< Element > | createVar (String name, ArrayList< Double > val, String type, int size, boolean minus) |
Vector< Element > | createSimpleVar (SimpleVariable var) |
Vector< Element > | createVar (Variable var) |
Vector< Element > | createVar (String name, double val, String type, boolean minus) |
Vector< Element > | createVar (String name) |
void | count (Element el) |
void | createInOutAff (Function top, HashMap< String, ReadWriteIndex > map) |
void | addPragma (String pragma) |
void | addPragma (String name, String type) |
void | changeVar (Element top, Variable varin, Variable varout) |
void | findInBody (Element top, HashMap< String, ReadWriteIndex > cpt) |
boolean | isVariable (String name) |
Vector< Variable > | monitoredVar () |
void | setBlock (Element top, String opName, BuildingBlock block) |
boolean | writeVHDL (String vhdlPath) |
void | print () |
boolean | writeSchematic (String outFile) |
void | writeOctaveFile () |
boolean | writeOctaveFile (String outFile) |
void | clean (Vector< Element > body, Vector< Element > varVector) |
void | updateConditionsFor (HashMap< String, ReadWriteIndex > tmpVar, HashMap< String, ReadWriteIndex > cptVar, LoopFor loopFor) |
void | updateConditionsWhile (HashMap< String, ReadWriteIndex > tmpVar, HashMap< String, ReadWriteIndex > cptVar, LoopWhile loopWhile) |
boolean | getMonitor () |
void | modifyMonitor (boolean monitor) |
boolean | isEmpty () |
boolean | fromXml (org.w3c.dom.Element el) |
String | getXmlTagName () |
org.w3c.dom.Element | toXml (Document dom) |
Vector< Element > | postParse (Function function) |
Vector< Element > | postParse (Vector< Element > vector) |
Static Public Member Functions | |
static String | getTrueName (String name) |
Static Public Attributes | |
static final String | TMP_NAME = "m2mtmp" |
Contains all the treatments make on the structure
Definition at line 44 of file StructTreatment.java.
m2m.backend.structure.StructTreatment.StructTreatment | ( | ) |
Constructor
Definition at line 96 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.addPragma | ( | String | pragma | ) |
Add a pragma and modify all the occurences that correspond to the pragma. It must be like : "%m2m name:type"
pragma | Pragma |
Definition at line 713 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.addPragma | ( | String | name, |
String | type | ||
) |
Add a pragma and modify all the occurences that correspond to the pragma. It must be a name and a type.
name | Name |
type | Type |
Definition at line 736 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.changeVar | ( | Element | top, |
Variable | varin, | ||
Variable | varout | ||
) |
Switch a variable by another in the structure. Change each instance.
top | Structure root |
varin | Variable to remplace |
varout | New variable |
Definition at line 796 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.clean | ( | Vector< Element > | body, |
Vector< Element > | varVector | ||
) |
Clean the structure by deleting all unused variable
Definition at line 1044 of file StructTreatment.java.
StructTreatment m2m.backend.structure.StructTreatment.copy | ( | ) |
Copy entirely the structure.
Definition at line 112 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.count | ( | Element | el | ) |
Add a counter to the name of the Element
el | Element |
Definition at line 657 of file StructTreatment.java.
Vector<Element> m2m.backend.structure.StructTreatment.createAff | ( | Variable | var, |
Vector< Element > | expr | ||
) |
Create an assignment
var | SimpleVariable, target of assignment |
expr | Operation list, the last element is to affect |
Definition at line 469 of file StructTreatment.java.
SimpleVariable m2m.backend.structure.StructTreatment.createInOut | ( | String | name | ) |
Create an in or out variable
name | Name of the variable |
Definition at line 508 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.createInOutAff | ( | Function | top, |
HashMap< String, ReadWriteIndex > | map | ||
) |
Create the final affectation for each in/out variables All input variables need to be affect to the first use of the variable: a_m2m_0 = a All output variables need to be affect to the last usw of the variable: s = s_m2m_17
map | Liste of the variables |
Definition at line 669 of file StructTreatment.java.
Create a "not" operation
a | Precedent operation list |
not | Operation "not" |
Definition at line 349 of file StructTreatment.java.
Vector<Element> m2m.backend.structure.StructTreatment.createOp | ( | Vector< Element > | a, |
Vector< Element > | b, | ||
Operation | op | ||
) |
Create operation and temporary variables if necessary
a | First operation list |
b | Second operation list |
op | Operation |
Definition at line 309 of file StructTreatment.java.
Vector<Element> m2m.backend.structure.StructTreatment.createSimpleVar | ( | SimpleVariable | var | ) |
Call the complete methode createVar, use an existing variable
var | SimpleVariable |
Definition at line 607 of file StructTreatment.java.
Vector<Element> m2m.backend.structure.StructTreatment.createVar | ( | String | name, |
ArrayList< Double > | val, | ||
String | type, | ||
int | size, | ||
boolean | minus | ||
) |
Create a variable. Check if existing, if yes juste return the adresse. If the variable is negative, check if the negation is already do, and if not create it. Crée une variable, vérifie si elle existe déjà et récupère l'objet dans ce cas, sinon en crée une nouvelle. Si la variable est négative elle vérifie si la négation est déjà créé, si non elle la crée.
name | Name |
val | Value |
type | Type |
minus | Negative (true if the variable is negative) |
Definition at line 535 of file StructTreatment.java.
Vector<Element> m2m.backend.structure.StructTreatment.createVar | ( | String | name, |
double | val, | ||
String | type, | ||
boolean | minus | ||
) |
Create the variable with the parameters
name | Name |
val | Value |
type | Type |
minus | Negative (true if the variable is negative) |
Definition at line 635 of file StructTreatment.java.
Check if the variable is an instance of VectorVariable or SimpleVariable and call the methode.
var | Variable |
Definition at line 617 of file StructTreatment.java.
Vector<Element> m2m.backend.structure.StructTreatment.createVar | ( | String | name | ) |
Create the variable with the parameters
name | Name |
Definition at line 647 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.findInBody | ( | Element | top, |
HashMap< String, ReadWriteIndex > | cpt | ||
) |
Definition at line 828 of file StructTreatment.java.
boolean m2m.backend.structure.StructTreatment.fromXml | ( | org.w3c.dom.Element | el | ) |
Definition at line 1289 of file StructTreatment.java.
Vector<Element> m2m.backend.structure.StructTreatment.getInput | ( | ) |
Getter of the input for internal structure
Definition at line 158 of file StructTreatment.java.
boolean m2m.backend.structure.StructTreatment.getMonitor | ( | ) |
Indicates if at least an element is monitored
Definition at line 1265 of file StructTreatment.java.
String m2m.backend.structure.StructTreatment.getName | ( | ) |
Getter of the name of the function
Definition at line 174 of file StructTreatment.java.
int m2m.backend.structure.StructTreatment.getNextOpCpt | ( | ) |
Operation counter
Definition at line 367 of file StructTreatment.java.
Vector<Element> m2m.backend.structure.StructTreatment.getOutput | ( | ) |
Getter of the output for internal structure
Definition at line 166 of file StructTreatment.java.
long m2m.backend.structure.StructTreatment.getParseTime | ( | ) |
Returns the time of the last parsing. This can be the parsing of a file or of an internal buffer.
Definition at line 134 of file StructTreatment.java.
String m2m.backend.structure.StructTreatment.getSourceCode | ( | ) |
Definition at line 264 of file StructTreatment.java.
String m2m.backend.structure.StructTreatment.getSourceMd5 | ( | ) |
Definition at line 260 of file StructTreatment.java.
Function m2m.backend.structure.StructTreatment.getTop | ( | ) |
Getter of the internal structure root
Definition at line 150 of file StructTreatment.java.
static String m2m.backend.structure.StructTreatment.getTrueName | ( | String | name | ) | [static] |
Remove the m2m extension to the name a_m2m_2 -> a
name | Name to analyse |
Definition at line 585 of file StructTreatment.java.
String m2m.backend.structure.StructTreatment.getXmlTagName | ( | ) |
Definition at line 1314 of file StructTreatment.java.
boolean m2m.backend.structure.StructTreatment.isEmpty | ( | ) |
Definition at line 1281 of file StructTreatment.java.
boolean m2m.backend.structure.StructTreatment.isVariable | ( | String | name | ) |
Check if the name is a already declared variable
name | Name of the variable |
Definition at line 871 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.modifyMonitor | ( | boolean | monitor | ) |
Set the monitor attribute of the structure.
monitor | The value to the monitor attribute to set |
Definition at line 1274 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.modifyNumType | ( | NumType | type | ) |
Definition at line 125 of file StructTreatment.java.
Vector<Variable> m2m.backend.structure.StructTreatment.monitoredVar | ( | ) |
Return the list of all monitored variables.
Definition at line 884 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.parse | ( | File | file | ) | throws ParsingException |
Run the parsing of the octave file
file | Octave file |
ParsingException | When parser can't parse the input file |
Definition at line 183 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.parse | ( | String | code | ) | throws ParsingException |
Run the parsing of the octave file
file | Text of the octave file |
ParsingException | When parser can't parse the input file |
Definition at line 273 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.parseNoFlat | ( | File | file | ) | throws ParsingException |
Run the parsing of the octave file
file | Octave file |
ParsingException | When parser can't parse the input file |
Definition at line 223 of file StructTreatment.java.
Post parse a vector of elements.
vector |
Definition at line 1383 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.print | ( | ) |
Print the internal structure
Definition at line 952 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.setBlock | ( | Element | top, |
String | opName, | ||
BuildingBlock | block | ||
) |
Set the material block who define the classe of element
top | Root of the structure |
opName | Name of the operation to change the material block |
block | Material block |
Definition at line 900 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.setTop | ( | Function | top | ) |
Setter of the internal structure root
top | Internal structure root |
Definition at line 142 of file StructTreatment.java.
org.w3c.dom.Element m2m.backend.structure.StructTreatment.toXml | ( | Document | dom | ) |
Definition at line 1318 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.treeToVector | ( | ) |
Convert the tree structure of the operation in a chain of simple operations : s=a+b+c -- c -- c -- + -- tmp -- + -- s -- + -- -- b ==> -- b -- a -- tmp s -- + -- -- a
Definition at line 382 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.treeToVector | ( | Function | parent | ) |
Convert the top Element from a tree structure to a chain of operations.
top | Root of the structure to convert |
Definition at line 390 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.updateConditionsFor | ( | HashMap< String, ReadWriteIndex > | tmpVar, |
HashMap< String, ReadWriteIndex > | cptVar, | ||
LoopFor | loopFor | ||
) |
Update condition simple varables for a "loopFor".
tmpVar | the temporary compter variable of the structure before the "loopFor" |
cptVar | the compter variable of the structure |
loopFor | the loopFor to update condition |
Definition at line 1105 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.updateConditionsWhile | ( | HashMap< String, ReadWriteIndex > | tmpVar, |
HashMap< String, ReadWriteIndex > | cptVar, | ||
LoopWhile | loopWhile | ||
) |
Update condition simple varables for a "loopWhile".
tmpVar | the temporary compter variable of the structure before the "loopWhile" |
cptVar | the compter variable of the structure |
loopFor | the loopFor to update condition |
Definition at line 1125 of file StructTreatment.java.
boolean m2m.backend.structure.StructTreatment.writeOctaveFile | ( | String | outFile | ) |
Write the octave code to a file
outFile | Name of the output file, if empty the file will be named "test/name_of_the_function.m" |
Definition at line 1005 of file StructTreatment.java.
void m2m.backend.structure.StructTreatment.writeOctaveFile | ( | ) |
Write the structure into an octave file
Definition at line 997 of file StructTreatment.java.
boolean m2m.backend.structure.StructTreatment.writeSchematic | ( | String | outFile | ) |
Write the schematic file. Use graphviz to generate the schematic. dot -Tpdf outfile -o schematic.pdf
outFile | Name of the file |
blockList | True if you want have blocs for the Vector |
Definition at line 962 of file StructTreatment.java.
boolean m2m.backend.structure.StructTreatment.writeVHDL | ( | String | vhdlPath | ) |
Write the internal structure to a VHDL file
outFile | File name |
IOException | |
VHDLException |
Definition at line 918 of file StructTreatment.java.
final String m2m.backend.structure.StructTreatment.TMP_NAME = "m2mtmp" [static] |
Use to reprensent temporary simple variable
Definition at line 73 of file StructTreatment.java.