cgma
|
00001 #ifndef MCNP2CAD_VOLUMES_H 00002 #define MCNP2CAD_VOLUMES_H 00003 00004 #include <cstdlib> 00005 #include "iGeom.h" 00006 00007 00008 class Transform; 00009 class SurfaceCard; 00010 00011 class SurfaceVolume{ 00012 00013 protected: 00014 const Transform* transform; 00015 00016 public: 00017 SurfaceVolume( const Transform* transform_p = NULL): 00018 transform(transform_p) 00019 {} 00020 virtual ~SurfaceVolume(){} 00021 00022 void setTransform( const Transform* transform_p ){ transform = transform_p; } 00023 00024 virtual double getFarthestExtentFromOrigin( ) const = 0; 00025 virtual iBase_EntityHandle define( bool positive, iGeom_Instance& igm, double world_size ); 00026 00027 protected: 00028 virtual iBase_EntityHandle getHandle( bool positive, iGeom_Instance& igm, double world_size ) = 0; 00029 }; 00030 00031 class VolumeCache; 00032 00041 extern 00042 SurfaceVolume& makeSurface( const SurfaceCard* card, VolumeCache* v = NULL ); 00043 00044 extern 00045 iBase_EntityHandle makeWorldSphere( iGeom_Instance& igm, double world_size ); 00046 00047 extern 00048 iBase_EntityHandle applyTransform( const Transform& t, iGeom_Instance& igm, iBase_EntityHandle& e ); 00049 00050 extern 00051 iBase_EntityHandle applyReverseTransform( const Transform& tx, iGeom_Instance& igm, iBase_EntityHandle& e ) ; 00052 00053 00054 00055 00056 00057 00058 // TODO: clean this igeom check function up 00059 #define CHECK_BUF_SIZE 512 00060 static char m_buf[CHECK_BUF_SIZE]; 00061 00062 #define CHECK_IGEOM(err, msg) \ 00063 do{/*std::cout << msg << std::endl;*/ if((err) != iBase_SUCCESS){ \ 00064 std::cerr << "iGeom error (" << err << "): " << msg << std::endl; \ 00065 iGeom_getDescription( igm, m_buf, CHECK_BUF_SIZE); \ 00066 std::cerr << " * " << m_buf << std::endl; \ 00067 } } while(0) 00068 00069 #endif /* MCNP2CAD_VOLUMES_H */