|
cgma
|
AngleCalc, another simple C++ driver for CGM. More...
#include <cassert>#include "stdio.h"#include "GeometryQueryTool.hpp"#include "GeometryModifyTool.hpp"#include "RefEdge.hpp"#include "RefVertex.hpp"#include "CoEdge.hpp"#include "RefFace.hpp"#include "CubitDefines.h"#include "CubitBox.hpp"#include "InitCGMA.hpp"#include "TestUtilities.hpp"Go to the source code of this file.
Defines | |
| #define | SRCDIR . |
| #define | STRINGIFY_(X) #X |
| #define | STRINGIFY(X) STRINGIFY_(X) |
| #define | SRCPATH STRINGIFY(SRCDIR) "/" |
| #define | PRINT_SEPARATOR PRINT_INFO("=======================================\n"); |
Functions | |
| int | AngleCalc () |
| int | main (int argc, char **argv) |
AngleCalc, another simple C++ driver for CGM.
This program acts as a simple driver for CGM. It reads in a geometry, and performs varies checks for bodies, surfaces, curves and vertices.
Definition in file AngleCalc.cpp.
| #define PRINT_SEPARATOR PRINT_INFO("=======================================\n"); |
Definition at line 45 of file AngleCalc.cpp.
| #define SRCDIR . |
Definition at line 27 of file AngleCalc.cpp.
Definition at line 39 of file AngleCalc.cpp.
| #define STRINGIFY | ( | X | ) | STRINGIFY_(X) |
Definition at line 38 of file AngleCalc.cpp.
| #define STRINGIFY_ | ( | X | ) | #X |
Definition at line 37 of file AngleCalc.cpp.
| int AngleCalc | ( | ) |
Definition at line 71 of file AngleCalc.cpp.
{
Body* brick = GeometryModifyTool::instance()->brick(1,2,4);
if(!brick)
{
printf("failed to make brick\n");
return 1;
}
// compute angles at each vertex and be sure they are 90 degrees
DLIList<RefFace*> faces;
GeometryQueryTool::instance()->ref_faces(faces);
bool errors = false;
for(int i=0; i<faces.size(); i++)
{
// get loops
DLIList<DLIList<CoEdge*> > loops;
RefFace* face = faces.get_and_step();
face->co_edge_loops(loops);
for(int j=0; j<loops.size(); j++)
{
for(int k=0; k<loops[j].size(); k++)
{
CoEdge* edge1 = loops[j].next(k);
CoEdge* edge2 = loops[j].next(k+1);
double angle = GeometryQueryTool::instance()->geometric_angle(edge1, edge2);
angle = angle * (180/CUBIT_PI);
if(fabs(90 - angle) > 0.01)
{
RefEdge* redge1 = edge1->get_ref_edge_ptr();
RefEdge* redge2 = edge2->get_ref_edge_ptr();
RefVertex* vert = redge1->common_ref_vertex(redge2);
printf("wrong angle at vertex (%f) %i with surface %i\n",
angle, vert->id(), face->id());
errors = true;
}
}
}
}
return errors ? 1 : 0;
}
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 49 of file AngleCalc.cpp.
{
CubitStatus s = InitCGMA::initialize_cgma( ENGINE );
if (CUBIT_SUCCESS != s) return 1;
//Do tests.
int rsl = AngleCalc();
if (rsl == 1)
PRINT_INFO("Operation Failed");
int ret_val = ( CubitMessage::instance()->error_count() );
if ( ret_val != 0 )
{
PRINT_ERROR("Errors found during Mergechk session.\n");
}
else
ret_val = 0;
return ret_val;
}