1 #ifndef GPM_ModelFunction_H
2 #define GPM_ModelFunction_H
34 SV::GPM_Rule mMappingRules;
35 map<tString,SP::GPM_Variable> mGlobalVariables;
36 SV::GPM_CompositorFunction mGlobalFunctions;
62 static inline SP::GPM_ModelFunction
New() {
120 mGlobalVariables.clear();
126 return mGlobalVariables;
134 void setGlobalVariable(
const tString& varName,SP::GPM_Variable var);
142 int i,n=fcts.getSize();
143 mGlobalFunctions.setSize(n);
144 for (i=0;i<n;i++) mGlobalFunctions[i]=fcts[i];
150 const tString& name,
const vector<tString>& realParameters,
const tString& body);
156 const vector<tString>& nameParameters,
157 const vector<tFlag>& typeParameters,
158 const vector<tFlag>& cardParameters,
159 const vector<tFlag>& isConstParameters,
161 const tFlag& returnType);
171 mGlobalFunctions.clear();
177 return mGlobalFunctions;
186 virtual void clear();
196 mMappingRules.add(rule);
202 if (index<mMappingRules.getSize())
203 mMappingRules.removeAtIndex(index);
208 return mMappingRules;
213 return mMappingRules;
255 const SV::GPM_Vertex& smallGraphVertices,
256 const vector<tVertexIID>& mapping,
268 const vector<tVertexIID>& mappingP2L,
269 const map<tVertexIID,tVertexIID>& mappingT2L,
CORE_Out& io);
273 const vector<tVertexIID>& mappingP2L,
CORE_Out& io);
278 const vector<tVertexIID>& mappingP2L,
279 const map<tVertexIID,tVertexIID>& mappingT2L,
309 static size_t findVariableName(
const tString& varName,
const tString& value,
const int& fromIndex) ;
void setPatternGraph(SP::GPM_PortGraph f)
set the pattern graph
Definition: GPM_Function.h:71
void setType(const tFlag &t)
set the type of the variable
Definition: GPM_Variable.h:96
static tString varNameToString(const tString &varName, const tString &graphLetter, const tString &elementLetter, const int &id)
useful function to create varname from vertex
Definition: GPM_ModelFunction.cpp:1912
void clearRules()
clear rules
Definition: GPM_ModelFunction.cpp:128
virtual tBoolean updatePTEdgesStates(SP::GPM_Edge PTedge, SP::GPM_Edge ledge, GPM_Graph &largeGraph, const vector< tVertexIID > &mappingP2L, const map< tVertexIID, tVertexIID > &mappingT2L, CORE_Out &io)
update the states of edges betwen pattern & transform graph
Definition: GPM_ModelFunction.cpp:1422
virtual tBoolean updatePatternGraphStates(GPM_Graph &largeGraph, const vector< tVertexIID > &mappingP2L, CORE_Out &io)
update the states of the transformed graph copied in the large graph
Definition: GPM_ModelFunction.cpp:960
void clearGlobalFunctions()
clear global variables
Definition: GPM_ModelFunction.h:170
tBoolean saveRulesToFile(const tString &fileName) const
Definition: GPM_ModelFunction.cpp:144
SV::GPM_Rule & getMappingRules()
get the mapping rules for writing
Definition: GPM_ModelFunction.h:212
void removeMappingRule(const int &index)
remove the mapping rule at index
Definition: GPM_ModelFunction.h:201
tString toString() const
return the string representation of the class
Definition: GPM_ModelFunction.cpp:1552
virtual void toDoAfterThisSetting()
method called after this setting
Definition: GPM_Function.h:53
virtual void toDoAfterThisSetting()
method called after this setting
Definition: GPM_ModelFunction.h:72
This class describes a patten function.
Definition: GPM_Function.h:20
static void expandVariableNames(const vector< tString > &vars, const int &id, tString &value, const tString &graphLetter, const tString &elementLetter)
replace variable names varName -> varName+"_"+graphLetter+"_"+id graphLetter -> graphLetter+"_"+id x ...
Definition: GPM_ModelFunction.cpp:1722
static SP::GPM_ModelFunction New()
create a port
Definition: GPM_ModelFunction.h:62
#define tBoolean
Definition: types.h:35
virtual void copy(const GPM_Function &rule)
copy
Definition: GPM_ModelFunction.cpp:21
const SV::GPM_Rule & getMappingRules() const
get the mapping rules for reading
Definition: GPM_ModelFunction.h:207
virtual ~GPM_ModelFunction(void)
destroy an object.
Definition: GPM_ModelFunction.cpp:17
void setGlobalFunctions(const SV::GPM_CompositorFunction &fcts)
set the global functions
Definition: GPM_ModelFunction.h:141
void addGlobalFunction(const GPM_ModelClassFactory &cf, const tString &name, const vector< tString > &realParameters, const tString &body)
add a real function
Definition: GPM_ModelFunction.cpp:120
void addGlobalVariables(const tString &variableName, const tString &value)
add a string global variable
Definition: GPM_ModelFunction.h:108
GPM_ModelFunction(void)
create an object
Definition: GPM_ModelFunction.cpp:9
void setValue(const int &cardinality, const double *values, const tFlag &type)
set the variable
Definition: GPM_Variable.cpp:74
DEFINE_SPTR(GPM_ModelClassFactory)
void updateRules(const GPM_ModelClassFactory &cf)
update the rule to new type of rule
Definition: GPM_ModelFunction.cpp:43
static const tFlag STRING
Definition: GPM_Variable.h:26
static tBoolean parseVarName(tString &varName, tString &graphLetter, tString &elementLetter, int &id)
useful function to parse varname & id
Definition: GPM_ModelFunction.cpp:1936
const map< tString, SP::GPM_Variable > & getGlobalVariables() const
Definition: GPM_ModelFunction.h:125
This class describes a node.
Definition: GPM_Variable.h:16
This class is the class to save GPM classes.
Definition: GPM_ModelClassFactory.h:16
void clearGlobalVariables()
clear global variables
Definition: GPM_ModelFunction.h:119
void addGlobalVariables(const tString &variableName, const tFlag &type, const double &value)
add a scalar global variable
Definition: GPM_ModelFunction.h:94
DEFINE_SVPTR(GPM_ModelFunction)
tBoolean readRulesFromFile(const tString &fileName, const GPM_ModelClassFactory &cf, CORE_Out &io)
read the rules the rules file format is has folow #size & list of ids of vertices of pattern graph to...
Definition: GPM_ModelFunction.cpp:413
#define tString
Definition: types.h:36
This class describes a graph which is a list of vertices, ports & edges.
Definition: GPM_PortGraph.h:22
virtual tBoolean updateTransformerGraphStates(GPM_Graph &largeGraph, const vector< tVertexIID > &mappingP2L, const map< tVertexIID, tVertexIID > &mappingT2L, CORE_Out &io)
update the states of the transformed graph copied in the large graph
Definition: GPM_ModelFunction.cpp:1175
void addGlobalVariables(const tString &variableName, const tFlag &type, const double *values, const int &n)
add a vector global variable
Definition: GPM_ModelFunction.h:101
This class describes a patten function.
Definition: GPM_PatternFunction.h:20
this class describes the output by default write on standart output
Definition: CORE_Out.h:21
void setGlobalVariables(const map< tString, SP::GPM_Variable > &variables)
set the global variable
Definition: GPM_ModelFunction.cpp:71
This class describes a pattern function.
Definition: GPM_ModelFunction.h:23
void setTransformerGraph(SP::GPM_PortGraph f)
set the transformer graph
Definition: GPM_Function.h:90
This class describes a graph which is a list of nodes & ports.
Definition: GPM_Graph.h:19
static SP::GPM_ModelGraph New()
create a test class
Definition: GPM_ModelGraph.h:56
void removeGlobalVariable(const tString &name)
delete a global variable
Definition: GPM_ModelFunction.cpp:97
const SV::GPM_CompositorFunction & getGlobalFunctions() const
Definition: GPM_ModelFunction.h:176
void addMappingRule(SP::GPM_Rule rule)
add the mapping rule
Definition: GPM_ModelFunction.h:195
virtual void clear()
clear all data for rules
Definition: GPM_ModelFunction.cpp:64
virtual tBoolean isMappingValid(const GPM_PortGraph &largeGraph, const SV::GPM_Vertex &smallGraphVertices, const vector< tVertexIID > &mapping, CORE_Out &io) const
return true if the mapping is valid
Definition: GPM_ModelFunction.cpp:1504
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14