|
cgma
|
#include <cassert>#include <iostream>#include "GeometryModifyTool.hpp"#include "GeometryQueryTool.hpp"#include "Body.hpp"#include "AppUtil.hpp"#include "InitCGMA.hpp"Go to the source code of this file.
Defines | |
| #define | TEST_ENGINE 0 |
| #define | BS 1.0 |
| #define | RAD 0.4 |
| #define | GQI GeometryQueryTool::instance() |
| #define | GMI GeometryModifyTool::instance() |
Functions | |
| int | main (int argc, char *argv[]) |
| #define BS 1.0 |
Definition at line 16 of file spheres.cpp.
| #define GMI GeometryModifyTool::instance() |
Definition at line 19 of file spheres.cpp.
| #define GQI GeometryQueryTool::instance() |
Definition at line 18 of file spheres.cpp.
| #define RAD 0.4 |
Definition at line 17 of file spheres.cpp.
| #define TEST_ENGINE 0 |
Definition at line 13 of file spheres.cpp.
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 21 of file spheres.cpp.
{
// Start up CGM
CubitStatus result = InitCGMA::initialize_cgma(TEST_ENGINE);
if (CUBIT_SUCCESS != result) return 1;
// Create a brick
Body* brick = GMI->brick(BS, BS, BS);
assert(brick != 0);
DLIList<Body *> bodies, single_body, all_bodies, neighbor_list, new_bodies;
all_bodies.append(brick);
for (int i = -1; i <= 1; i+= 2) {
for (int j = -1; j <= 1; j+= 2) {
for (int k = -1; k <= 1; k+= 2) {
Body* sph = GMI->sphere(RAD);
assert(brick != 0);
DLIList<Body*> bods;
bods.append(sph);
GQI->translate(bods, CubitVector(i*.5*BS, j*.5*BS, k*.5*BS));
bodies.append(sph);
}
}
}
CubitStatus stat = GMI->unite(bodies, single_body);
assert(CUBIT_SUCCESS == stat && single_body.size() == 1);
stat = GMI->webcut_with_body(all_bodies, single_body.get(), new_bodies, neighbor_list);
assert(CUBIT_SUCCESS == stat);
std::cout << "Number of resulting bodies = " << new_bodies.size() << std::endl;
DLIList<RefEntity*> re_list;
for (int i = 0; i < new_bodies.size(); i++) re_list.append(new_bodies.get_and_step());
bodies.clean_out();
GQI->bodies(bodies);
assert (bodies.size() == 10);
//delete all entities
GQI->delete_Body(bodies);
DLIList<RefEntity*> free_entities;
GQI->get_free_ref_entities(free_entities);
assert(free_entities.size() ==0);
return 0;
}