MeshKit  1.0
MeshOpTemplate.cpp
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include "meshkit/MeshOpTemplate.hpp"
00003 #include "meshkit/MKCore.hpp"
00004 #include "meshkit/SizingFunction.hpp"
00005 #include "meshkit/RegisterMeshOp.hpp"
00006 #include "meshkit/LocalSet.hpp"
00007 #include "meshkit/ModelEnt.hpp"
00008 
00009 #include "iMesh_extensions.h"
00010 #include "MBCN.h"
00011 
00012 
00013 namespace MeshKit
00014 {
00015   // static registration of this  mesh scheme
00016   moab::EntityType MeshOpTemplate_tps[] = { moab::MBVERTEX,
00017                                             moab::MBEDGE,
00018                                             moab::MBTRI,
00019                                             moab::MBHEX,
00020                                             moab::MBMAXTYPE};
00021   const moab::EntityType* MeshOpTemplate::output_types()
00022   { return MeshOpTemplate_tps; }
00023 
00024   MeshOpTemplate::MeshOpTemplate(MKCore *mkcore, const MEntVector &me_vec)
00025     : MeshScheme(mkcore, me_vec),
00026       igeomImpl(mkcore->igeom_instance())
00027     //igeomImpl(mkcore->igeom_instance(), mkmoab(mkcore->moab_instance())
00028   {
00029     s_x[0] = 1.0;
00030     s_x[1] = 1.0;
00031     s_x[2] = 1.0;
00032   }
00033 
00034   MeshOpTemplate::~MeshOpTemplate()
00035   {}
00036 
00037   bool MeshOpTemplate::add_modelent(ModelEnt *model_ent)
00038   {
00039     return MeshOp::add_modelent(model_ent);
00040   }
00041 
00042   void MeshOpTemplate::setup_this()
00043   {
00044   }
00045 
00046   void MeshOpTemplate::execute_this()
00047   {
00048     iBase_EntityHandle_Private * argf = NULL;
00049     igeomImpl->createBrick(s_x[0], s_x[1], s_x[2], argf);
00050     printf("Made a brick!\n");
00051 
00052     iBase_EntitySetHandle seth;
00053     iBase_TagHandle mattag;
00054     std::string brick = "opbrick";
00055     std::string name_tag_id = "NAME";
00056     // testing to see if this propages to mesh and how to use iRel for relating mesh and geometry mp.brep
00057     std::string mtag_name = "MATERIAL_TAG";
00058     iBase_TagHandle name_tag;
00059     igeomImpl->getTagHandle(name_tag_id.c_str(),name_tag);
00060 
00061     // create material_set tag
00062     igeomImpl->createTag(mtag_name.c_str(),1, iBase_INTEGER, mattag);
00063 
00064     igeomImpl->createEntSet(false, seth);
00065     igeomImpl->addEntToSet(argf, seth);
00066 
00067     igeomImpl->setEntSetData(seth,name_tag,brick.c_str());
00068 
00069     int matid = 111555;
00070     igeomImpl->setData(argf,mattag,(char*)(&matid));
00071     // This does not work?
00072     //igeomImpl->setEntSetData(seth,mattag, (char*)(&matid));
00073     // Meshing this with test_ngtetmesher does NOT produce an material set
00074     bool save = false;
00075     if (save == true)
00076       igeomImpl->save("mp.brep");
00077 
00078   }
00079 
00080   // set the size of the brick - s_x
00081   void MeshOpTemplate::set_size(const Vector<3> &dx)
00082   {
00083     s_x = dx;
00084   }
00085 
00086   void MeshOpTemplate::tag_copied_sets(const char **tag_names, const char **tag_vals,
00087                                        const int num_tags)
00088   {
00089     // TODO:
00090   }
00091 
00092 } // namespace MeshKit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines