MeshKit  1.0
example_intassign.cpp
Go to the documentation of this file.
00001 
00017 #include "meshkit/MKCore.hpp"
00018 
00019 #include "meshkit/IAInterface.hpp"
00020 #include "meshkit/IAVariable.hpp"
00021 #include "meshkit/TFIMapping.hpp"
00022 
00023 #include <stdio.h>
00024 #include <iostream>
00025 #ifdef HAVE_ACIS
00026 #define INTASSIGN_TEST_FILE "quadface.sat"
00027 #elif defined(HAVE_OCC)
00028 #define INTASSIGN_TEST_FILE "quadface.stp"
00029 #endif
00030 
00031 MeshKit::MKCore *mk;
00032 
00033 MeshKit::IAInterface *new_ia_interface()
00034 {
00035   return
00036       (MeshKit::IAInterface*) mk->construct_meshop("IntervalAssignment");
00037 }
00038 
00039 void mapping_test() 
00040 {
00041 
00042 }
00043 
00044 int main(int argv, char* argc[])
00045 {
00046   // currently unable to create more than one mk called IntervalAssignment
00047   mk = new MeshKit::MKCore();
00048   MeshKit::IAInterface *ia_interface = new_ia_interface();
00049   ia_interface->destroy_data();
00050 
00051   std::string file_name = (std::string) MESH_DIR +  "/" + INTASSIGN_TEST_FILE;
00052   printf("opening %s\n", file_name.c_str());
00053   mk->load_geometry_mesh(file_name.c_str(), NULL);
00054 
00055   //check the number of geometrical edges
00056   MeshKit::MEntVector surfs, loops;
00057   mk->get_entities_by_dimension(2, surfs);
00058   MeshKit::ModelEnt *this_surf = (*surfs.rbegin());
00059 
00060   MeshKit::MEntVector curves;
00061   std::vector<int> senses, loop_sizes;
00062   this_surf->boundary(1, curves, &senses, &loop_sizes);
00063 
00064   MeshKit::SizingFunction esize(mk, 3, -1);
00065   surfs[0]->sizing_function_index(esize.core_index());
00066 
00067   MeshKit::MEntVector side1, side2;
00068   side1.push_back(curves[0]); side2.push_back(curves[2]);
00069   ia_interface->constrain_sum_equal(ia_interface->make_constraint_group(side1),
00070                                     ia_interface->make_constraint_group(side2));
00071   side1.clear(); side2.clear();
00072   side1.push_back(curves[1]); side2.push_back(curves[3]);
00073   ia_interface->constrain_sum_equal(ia_interface->make_constraint_group(side1),
00074                                     ia_interface->make_constraint_group(side2));
00075 
00076   // if there are loops, and the loops have strictly less than 4 curves, then
00077   // ia_interface->constrain_sum_even( ia_interface->make_constraint_group(curves in loop) );
00078 
00079   //now, do the TFIMapping
00080   (MeshKit::TFIMapping*) mk->construct_meshop("TFIMapping", surfs);
00081   mk->setup_and_execute();
00082   mk->save_mesh("intassign.h5m");
00083   return 0;
00084 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines