Back to index

salome-smesh  6.5.0
Typedefs | Functions | Variables
DriverSTL_R_SMDS_Mesh.cxx File Reference
#include <stdio.h>
#include <gp_Pnt.hxx>
#include "DriverSTL_R_SMDS_Mesh.h"
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include <OSD_Path.hxx>
#include <OSD_File.hxx>
#include <OSD_FromWhere.hxx>
#include <OSD_Protection.hxx>
#include <OSD_SingleProtection.hxx>
#include <Standard_NoMoreObject.hxx>
#include "utilities.h"
#include <NCollection_DataMap.hxx>

Go to the source code of this file.

Typedefs

typedef NCollection_DataMap
< gp_Pnt, SMDS_MeshNode * > 
DriverSTL_DataMapOfPntNodePtr

Functions

Standard_Integer HashCode (const gp_Pnt &point, Standard_Integer Upper)
Standard_Boolean IsEqual (const gp_Pnt &point1, const gp_Pnt &point2)
static Standard_Real readFloat (OSD_File &theFile)
static SMDS_MeshNode * addNode (const gp_Pnt &P, DriverSTL_DataMapOfPntNodePtr &uniqnodes, SMDS_Mesh *theMesh)
static SMDS_MeshNode * readNode (FILE *file, DriverSTL_DataMapOfPntNodePtr &uniqnodes, SMDS_Mesh *theMesh)
static SMDS_MeshNode * readNode (OSD_File &theFile, DriverSTL_DataMapOfPntNodePtr &uniqnodes, SMDS_Mesh *theMesh)

Variables

static Standard_Real tab1 [3]
static Standard_Real tab2 [3]
static const int HEADER_SIZE = 84
static const int SIZEOF_STL_FACET = 50
static const int ASCII_LINES_PER_FACET = 7

Typedef Documentation

typedef NCollection_DataMap<gp_Pnt,SMDS_MeshNode*> DriverSTL_DataMapOfPntNodePtr

Definition at line 80 of file DriverSTL_R_SMDS_Mesh.cxx.


Function Documentation

static SMDS_MeshNode* addNode ( const gp_Pnt &  P,
DriverSTL_DataMapOfPntNodePtr uniqnodes,
SMDS_Mesh *  theMesh 
) [static]

Definition at line 181 of file DriverSTL_R_SMDS_Mesh.cxx.

{
  SMDS_MeshNode* node = 0;
  if ( uniqnodes.IsBound(P) ) {
    node = uniqnodes.Find(P);
  } else {
    node = theMesh->AddNode(P.X(), P.Y(), P.Z() );
    uniqnodes.Bind(P,node);
  }
  
  return node;
}                                

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Integer HashCode ( const gp_Pnt &  point,
Standard_Integer  Upper 
) [inline]

Definition at line 30 of file DriverSTL_R_SMDS_Mesh.cxx.

{
  union 
    {
    Standard_Real R[3];
    Standard_Integer I[6];
    } U;

  point.Coord(U.R[0],U.R[1],U.R[2]);  

  return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper);
}
Standard_Boolean IsEqual ( const gp_Pnt &  point1,
const gp_Pnt &  point2 
) [inline]

Definition at line 49 of file DriverSTL_R_SMDS_Mesh.cxx.

{
  point1.Coord(tab1[0],tab1[1],tab1[2]);  
  point2.Coord(tab2[0],tab2[1],tab2[2]);  
  return (memcmp(tab1,tab2,sizeof(tab1)) == 0);
}

Here is the caller graph for this function:

static Standard_Real readFloat ( OSD_File &  theFile) [static]

Definition at line 161 of file DriverSTL_R_SMDS_Mesh.cxx.

{
  union {
    Standard_Boolean i; 
    Standard_ShortReal f;
  }u;

  char c[4];
  Standard_Address adr;
  adr = (Standard_Address)c;
  Standard_Integer lread;
  theFile.Read(adr,4,lread);
  u.i  =  c[0] & 0xFF;
  u.i |= (c[1] & 0xFF) << 0x08;
  u.i |= (c[2] & 0xFF) << 0x10;
  u.i |= (c[3] & 0xFF) << 0x18;

  return u.f;
}

Here is the caller graph for this function:

static SMDS_MeshNode* readNode ( FILE *  file,
DriverSTL_DataMapOfPntNodePtr uniqnodes,
SMDS_Mesh *  theMesh 
) [static]

Definition at line 196 of file DriverSTL_R_SMDS_Mesh.cxx.

{
  Standard_ShortReal coord[3];
  // reading vertex
  fscanf(file,"%*s %f %f %f\n",&coord[0],&coord[1],&coord[2]);

  gp_Pnt P(coord[0],coord[1],coord[2]);
  return addNode( P, uniqnodes, theMesh );
}

Here is the call graph for this function:

static SMDS_MeshNode* readNode ( OSD_File &  theFile,
DriverSTL_DataMapOfPntNodePtr uniqnodes,
SMDS_Mesh *  theMesh 
) [static]

Definition at line 208 of file DriverSTL_R_SMDS_Mesh.cxx.

{
  Standard_ShortReal coord[3];
  coord[0] = readFloat(theFile);
  coord[1] = readFloat(theFile);
  coord[2] = readFloat(theFile);

  gp_Pnt P(coord[0],coord[1],coord[2]);
  return addNode( P, uniqnodes, theMesh );
}

Here is the call graph for this function:


Variable Documentation

const int ASCII_LINES_PER_FACET = 7 [static]

Definition at line 73 of file DriverSTL_R_SMDS_Mesh.cxx.

const int HEADER_SIZE = 84 [static]

Definition at line 70 of file DriverSTL_R_SMDS_Mesh.cxx.

const int SIZEOF_STL_FACET = 50 [static]

Definition at line 71 of file DriverSTL_R_SMDS_Mesh.cxx.

Standard_Real tab1[3] [static]

Definition at line 42 of file DriverSTL_R_SMDS_Mesh.cxx.

Standard_Real tab2[3] [static]

Definition at line 43 of file DriverSTL_R_SMDS_Mesh.cxx.