MeshKit  1.0
test_graph.cpp
Go to the documentation of this file.
00001 
00020 #include "meshkit/MKCore.hpp"
00021 #include "meshkit/MeshOp.hpp"
00022 #include "meshkit/RegisterMeshOp.hpp"
00023 
00024 using namespace MeshKit;
00025 
00026 class MyScheme;
00027 
00028 class MyScheme : public MeshKit::MeshOp 
00029 {
00030 public:
00031   MyScheme(MKCore*, const MEntVector &);
00032   
00033   inline void setup_this() 
00034       {std::cout << "myScheme (setup), node " << get_name() << std::endl;
00035       }
00036   
00037   inline void execute_this() 
00038       {std::cout << "myScheme (execute), node " << get_name() << std::endl;
00039       }
00040 
00041   inline void mesh_types(std::vector<moab::EntityType> &tps) 
00042       {
00043       }
00044       
00045   static const char* name() { return "MyScheme"; }
00046   static bool can_mesh(iBase_EntityType dim) { return dim == iBase_REGION; }
00047   static bool can_mesh(ModelEnt* ent) { return canmesh_region(ent); }
00048   static const moab::EntityType* output_types() 
00049     { 
00050       static moab::EntityType end = moab::MBMAXTYPE;
00051       return &end;
00052     }
00053   const moab::EntityType* mesh_types_arr() const
00054     { return output_types(); }
00055   
00056 };
00057 
00058 inline MyScheme::MyScheme(MKCore *mk_core, const MEntVector & me_vec) 
00059         : MeshOp(mk_core, me_vec)
00060 {}
00061 
00062 //---------------------------------------------------------------------------//
00063 RegisterMeshOp<MyScheme> INIT;
00064 //---------------------------------------------------------------------------//
00065 
00066 int main(int argc, char **argv) 
00067 {
00068     // start up MK and register my scheme with it
00069   MKCore mk;
00070 
00071     // create the scheme objects
00072   MeshOp *A = mk.construct_meshop("MyScheme"),
00073       *B = mk.construct_meshop("MyScheme"),
00074       *C = mk.construct_meshop("MyScheme"),
00075       *D = mk.construct_meshop("MyScheme");
00076 
00077   A->set_name("A");
00078   B->set_name("B");
00079   C->set_name("C");
00080   D->set_name("D");
00081   
00082     // put them in the graph
00083   //mk.get_graph().addArc(A->get_node(), C->get_node());
00084   mk.insert_node(A, C);
00085   //mk.get_graph().addArc(A->get_node(), D->get_node());
00086   mk.insert_node(A, D);
00087   
00088     // now traverse
00089   mk.setup();
00090   
00091   mk.execute();
00092  
00093   mk.print_graph();
00094 }
00095 
00096   
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines