AngleCalc.cpp File Reference

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.


#define SRCDIR   .
#define STRINGIFY_(X)   #X
#define PRINT_SEPARATOR   PRINT_INFO("=======================================\n");


int AngleCalc ()
int main (int argc, char **argv)

Detailed Description

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 Documentation

#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.

Function Documentation

int AngleCalc ( )

Definition at line 71 of file AngleCalc.cpp.

  Body* brick = GeometryModifyTool::instance()->brick(1,2,4);
    printf("failed to make brick\n");
    return 1;

  // compute angles at each vertex and be sure they are 90 degrees
  DLIList<RefFace*> faces;

  bool errors = false;

  for(int i=0; i<faces.size(); i++)
    // get loops
    DLIList<DLIList<CoEdge*> > loops;
    RefFace* face = faces.get_and_step();

    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");
    ret_val = 0;

  return ret_val;
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines