/usr/include/vtk-6.3/vtkmetaio/metaMesh.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | /*============================================================================
MetaIO
Copyright 2000-2010 Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "metaTypes.h"
#ifndef ITKMetaIO_METAMESH_H
#define ITKMetaIO_METAMESH_H
#include "metaUtils.h"
#include "metaObject.h"
#ifdef _MSC_VER
#pragma warning ( disable: 4251 )
#endif
#include <list>
/*! MetaMesh (.h and .cxx)
*
* Description:
* Reads and Writes MetaMeshFiles.
*
* \author Julien Jomier
*
* \date June, 2004
*
* Depends on:
* MetaUtils.h
*/
#if (METAIO_USE_NAMESPACE)
namespace METAIO_NAMESPACE {
#endif
/** Typedef for the type of cells */
#define MET_NUM_CELL_TYPES 9
enum MET_CellGeometry {MET_VERTEX_CELL=0, MET_LINE_CELL, MET_TRIANGLE_CELL, MET_QUADRILATERAL_CELL,
MET_POLYGON_CELL, MET_TETRAHEDRON_CELL, MET_HEXAHEDRON_CELL,
MET_QUADRATIC_EDGE_CELL, MET_QUADRATIC_TRIANGLE_CELL};
const unsigned char MET_CellSize[MET_NUM_VALUE_TYPES] = {
1,2,3,4,5,4,8,3,6};
const char MET_CellTypeName[MET_NUM_VALUE_TYPES][4] = {
{'V','R','T','\0'},
{'L','N','E','\0'},
{'T','R','I','\0'},
{'Q','A','D','\0'},
{'P','L','Y','\0'},
{'T','E','T','\0'},
{'H','E','X','\0'},
{'Q','E','D','\0'},
{'Q','T','R','\0'}};
/** Define a mesh point */
class METAIO_EXPORT MeshPoint
{
public:
MeshPoint(int dim);
~MeshPoint();
unsigned int m_Dim;
float* m_X;
int m_Id;
};
/** Define a mesh cell
* a cell contains a list of Ids corresponding to the list
* of points */
class METAIO_EXPORT MeshCell
{
public:
MeshCell(int dim);
~MeshCell();
int m_Id;
unsigned int m_Dim;
int* m_PointsId;
};
/** Define a mesh cell links
* a celllink contains a list of Ids corresponding to the list
* of links cells */
class METAIO_EXPORT MeshCellLink
{
public:
MeshCellLink()
{
m_Id = 0;
}
~MeshCellLink()
{
}
int m_Id; // id of the cell link
METAIO_STL::list<int> m_Links;
};
/** Define a mesh point data */
class METAIO_EXPORT MeshDataBase
{
public:
MeshDataBase()
{
m_Id = -1;
}
virtual ~MeshDataBase()
{
}
virtual void Write( METAIO_STREAM::ofstream* stream) = 0;
virtual unsigned int GetSize(void) = 0;
virtual MET_ValueEnumType GetMetaType() = 0;
int m_Id;
protected:
METAIO_STREAM::ifstream* m_ReadStream;
METAIO_STREAM::ofstream* m_WriteStream;
};
/** Mesh point data class for basic types (i.e int, float ... ) */
template<typename TElementType>
class METAIO_EXPORT MeshData : public MeshDataBase
{
public:
MeshData() {m_Id=-1;}
~MeshData() {}
virtual MET_ValueEnumType GetMetaType()
{
return MET_GetPixelType(typeid(TElementType));
}
virtual void Write( METAIO_STREAM::ofstream* stream)
{
//char* id = new char[sizeof(int)];
// The file is written as LSB by default
int mid = m_Id;
MET_SwapByteIfSystemMSB(&mid,MET_INT);
//MET_DoubleToValue((double)m_Id,MET_INT,id,0);
stream->write((char *)&mid,sizeof(int));
//delete [] id;
//char* data = new char[sizeof(m_Data)];
//double mdata = m_Data;
//MET_DoubleToValue((double)m_Data,GetMetaType(),data,0);
TElementType data = m_Data;
MET_SwapByteIfSystemMSB(&data,GetMetaType());
stream->write((char *)&data,sizeof(data));
}
virtual unsigned int GetSize(void)
{
unsigned int size = sizeof(int);
size += sizeof(m_Data);
return size;
}
TElementType m_Data;
};
class METAIO_EXPORT MetaMesh : public MetaObject
{
/////
//
// PUBLIC
//
////
public:
typedef METAIO_STL::list<MeshPoint*> PointListType;
typedef METAIO_STL::list<MeshCell*> CellListType;
typedef METAIO_STL::list<MeshCellLink*> CellLinkListType;
typedef METAIO_STL::list<MeshDataBase*> PointDataListType;
typedef METAIO_STL::list<MeshDataBase*> CellDataListType;
////
//
// Constructors & Destructor
//
////
MetaMesh(void);
MetaMesh(const char *_headerName);
MetaMesh(const MetaMesh *_tube);
MetaMesh(unsigned int dim);
~MetaMesh(void);
void PrintInfo(void) const;
void CopyInfo(const MetaObject * _object);
// NPoints(...)
// Required Field
// Number of points wich compose the mesh
int NPoints(void) const;
// NCells(...)
// Required Field
// Number of cells wich compose the mesh
int NCells(void) const;
// NCellLinks(...)
// Required Field
// Number of cellLinks wich compose the mesh
int NCellLinks(void) const;
// NCellTypes(...)
// Required Field
// Number of celles wich compose the mesh
void NCellTypes(int ncelltypes);
int NCellTypes(void) const;
/** Clear the metaMesh */
void Clear(void);
PointListType & GetPoints(void) {return m_PointList;}
const PointListType & GetPoints(void) const {return m_PointList;}
CellListType & GetCells(MET_CellGeometry geom) {return *(m_CellListArray[geom]);}
const CellListType & GetCells(MET_CellGeometry geom) const {return *(m_CellListArray[geom]);}
CellLinkListType & GetCellLinks(void) {return m_CellLinks;}
const CellLinkListType & GetCellLinks(void) const {return m_CellLinks;}
PointDataListType & GetPointData(void) {return m_PointData;}
const PointDataListType & GetPointData(void) const {return m_PointData;}
CellDataListType & GetCellData(void) {return m_CellData;}
const CellDataListType & GetCellData(void) const {return m_CellData;}
MET_ValueEnumType PointDataType(void) const {return m_PointDataType;}
void PointDataType(MET_ValueEnumType _elementType){m_PointDataType = _elementType;}
MET_ValueEnumType CellDataType(void) const {return m_CellDataType;}
void CellDataType(MET_ValueEnumType _elementType){m_CellDataType = _elementType;}
////
//
// PROTECTED
//
////
protected:
bool m_ElementByteOrderMSB;
void M_Destroy(void);
void M_SetupReadFields(void);
void M_SetupWriteFields(void);
bool M_Read(void);
bool M_Write(void);
int m_NPoints;
int m_NCells;
int m_NCellLinks;
int m_NPointData;
int m_NCellData;
char m_PointDim[255]; // "PointDim = " "x y z r"
PointListType m_PointList;
// We store the Cell lists in a vector
CellListType* m_CellListArray[MET_NUM_CELL_TYPES];
CellLinkListType m_CellLinks;
PointDataListType m_PointData;
CellDataListType m_CellData;
MET_ValueEnumType m_PointType;
MET_ValueEnumType m_PointDataType;
MET_ValueEnumType m_CellDataType;
};
#if (METAIO_USE_NAMESPACE)
};
#endif
#endif
|