1 #ifndef GPM_PortGraph_H
2 #define GPM_PortGraph_H
42 unsigned int mIterations;
43 unsigned int mIterationsMaxNumber;
46 SV::GPM_PatternFunction mPatternFunctions;
47 SP::GPM_PatternFunction mF;
66 virtual ~GPM_PortGraph(
void);
75 static inline SP::GPM_PortGraph
New() {
119 mIterationsMaxNumber=v;
125 return mIterationsMaxNumber;
131 virtual SP::GPM_GraphElement newInstance(
const tString& className)
const;
142 SP::GPM_Port port=newPort();
150 SP::GPM_Port port=newPort();
151 port->setId(generateVertexId());
165 tBoolean addPortEdgeFromIds(
const int& from,
const int& to,
166 const int& fromPortId,
const int& toPortId,
172 return addPortEdgeFromIds(fromId,toId,fromPortId,toPortId,fromPortIID,toPortIID);
181 void updateGraphElementsEnvironment(
const map<tString,SP::GPM_Variable>& nodeEnvironment,
182 const map<tString,SP::GPM_Variable>& portEnvironment,
183 const map<tString,SP::GPM_Variable>& edgeEnvironment);
187 void buildEnvironments(map<tString,SP::GPM_Variable>& nodeEnvironment,
188 map<tString,SP::GPM_Variable>& portEnvironment,
189 map<tString,SP::GPM_Variable>& edgeEnvironment)
const;
198 void initGroupNames(
const vector<tString>& nodeIds,
const vector<tString>& portIds);
202 vector<tString> nodeIds,portIds;
203 initGroupNames(nodeIds,portIds);
209 mPatternFunctions.clear();
214 mPatternFunctions.add(f);
220 return mPatternFunctions;
236 void generateQuadGraph(
const int& nTriangles,
const tBoolean& withMiddle,
const int& n,
const int& m,
const tReal& w,
const tReal& h,
const tReal& xmin,
const tReal& ymin);
252 virtual tBoolean isMappingValid(
const SV::GPM_Vertex& smallGraphVertices,
253 const vector<tVertexIID>& mapping,
268 void findMesh(
const vector<tFlag>& meshTypes,vector<vector<tVertexIID> >& geometries)
const {
269 for (
size_t i=0;i<meshTypes.size();i++)
270 findMesh(meshTypes[i],geometries);
275 void findMesh(
const tFlag& meshType,vector<vector<tVertexIID> >& geometries)
const;
279 void findSegments(vector<vector<tVertexIID> >& geometry)
const;
304 tBoolean rewrite(SV::GPM_PatternFunction& patternFunction,
int& nReductions,
CORE_Out& io);
317 return rewrite(mPatternFunctions,nReductions,io);
324 const vector<vector<vector<tVertexIID> > >& fmappings)
const{
344 setIterationsMaxNumber(nMaxIterations);
static const tFlag HEXAHEDRON
Definition: GPM_PortGraph.h:32
void setPath(const tString &path)
set the path
Definition: GPM_PortGraph.h:85
DEFINE_SPTR(GPM_PortGraph)
void initGroupNames()
init group name to type of the vertex
Definition: GPM_PortGraph.h:201
int getIteration() const
get the prefix
Definition: GPM_PortGraph.h:113
static const tFlag TRIANGLE
Definition: GPM_PortGraph.h:28
SV::GPM_PatternFunction & getPatternFunctions()
get the pattern functions
Definition: GPM_PortGraph.h:219
tString getPath() const
get the path
Definition: GPM_PortGraph.h:90
static const tFlag SEGMENT
Definition: GPM_PortGraph.h:27
static const tFlag TETRAHEDRON
Definition: GPM_PortGraph.h:29
int run(int argc, char *argv[])
Definition: GPM_ExamplesMain.cpp:3
tBoolean rewrite(int &nReductions, CORE_Out &io)
rewrite the graph substitute the patterns by the graphs defined in PatternFunctions algorithm: ...
Definition: GPM_PortGraph.h:316
static SP::GPM_PortGraph New()
create a graph
Definition: GPM_PortGraph.h:75
#define tBoolean
Definition: types.h:35
void setPrefix(const tString &v)
set the prefix
Definition: GPM_PortGraph.h:95
tVertexIID addPort()
add port
Definition: GPM_PortGraph.h:149
virtual void patternsMappingSignalEmit(const SVC::GPM_PatternFunction patternFunction, const vector< vector< vector< tVertexIID > > > &fmappings) const
signal emmiting when the matching of patterns is done
Definition: GPM_PortGraph.h:323
void addPatternFunction(SP::GPM_PatternFunction f)
add pattern function
Definition: GPM_PortGraph.h:213
This class describes a node.
Definition: GPM_Vertex.h:16
int getIterationsMaxNumber() const
get the max iterations number
Definition: GPM_PortGraph.h:124
void findMesh(const vector< tFlag > &meshTypes, vector< vector< tVertexIID > > &geometries) const
get all the geometries vertex <–> vertex without ports inside.
Definition: GPM_PortGraph.h:268
#define SP_OBJECT(X)
Definition: CORE_Pointers.h:176
void clearPatternFunctions()
clear pattern functions
Definition: GPM_PortGraph.h:208
tVertexIID addPort(const int &id)
add port
Definition: GPM_PortGraph.h:141
tVertexIID addVertex(SP::GPM_Vertex vertex)
add vertex vertex with id
Definition: GPM_Graph.cpp:306
tGraph::vertex_descriptor tVertexIID
Definition: GPM_Types.h:45
static const tFlag PYRAMID
Definition: GPM_PortGraph.h:30
#define DEFINE_SVPTR(X)
Definition: CORE_ListPointers.h:21
static SP::GPM_Port New()
create a port
Definition: GPM_Port.h:49
void setIteration(const int &v)
set the iteration
Definition: GPM_PortGraph.h:107
void setIterationsMaxNumber(const int &v)
set the max iterations number
Definition: GPM_PortGraph.h:118
#define tString
Definition: types.h:36
tVertexIID addPort(SP::GPM_Port port)
add port
Definition: GPM_PortGraph.h:156
This class describes a graph which is a list of vertices, ports & edges.
Definition: GPM_PortGraph.h:22
tBoolean addPortEdgeFromIds(const int &fromId, const int &toId, const int &fromPortId, const int &toPortId)
add 2 ports with ids fromPortId, toPortId from vertex with id from to vertex with id to ...
Definition: GPM_PortGraph.h:170
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
tString getPrefix() const
get the prefix
Definition: GPM_PortGraph.h:100
static const tFlag WEDGE
Definition: GPM_PortGraph.h:31
This class describes a graph which is a list of nodes & ports.
Definition: GPM_Graph.h:19
tBoolean run(const tString &path, const tString &prefix, const int &nMaxIterations, CORE_Out &io)
run the writer
Definition: GPM_PortGraph.h:341
#define tReal
Definition: types.h:18
virtual SP::GPM_Port newPort() const
create a port
Definition: GPM_PortGraph.h:134
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14