add lab3
This commit is contained in:
57
lab3/writeGrid2DOFF.h
Normal file
57
lab3/writeGrid2DOFF.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// Functions to write grid2DPoints3D as a Geomview .off file.
|
||||
|
||||
#ifndef WRITE_GRID2D_OFF_H
|
||||
#define WRITE_GRID2D_OFF_H
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "grid2DPoints3D.h"
|
||||
|
||||
|
||||
// ********************************************************************************
|
||||
// Class WRITE_GRID2D_OFF
|
||||
// ********************************************************************************
|
||||
|
||||
/// A class for writing GRID2D_POINTS3D as a Geomview .off file.
|
||||
class WRITE_GRID2D_OFF {
|
||||
|
||||
public:
|
||||
|
||||
const std::string OFF_HEADER = "OFF";
|
||||
|
||||
WRITE_GRID2D_OFF() {}
|
||||
|
||||
std::string Header() const { return OFF_HEADER; }
|
||||
|
||||
/// Write the OFF file header line.
|
||||
void WriteHeader(std::ostream& file) const;
|
||||
|
||||
/// Write a comment line.
|
||||
void WriteComment(std::ostream& file, const std::string& msg) const;
|
||||
|
||||
/// Write the counts: num_points, num_quads, 0 (edges).
|
||||
void WriteNumElements(std::ostream& file,
|
||||
const GRID2D_POINTS3D& grid2D) const;
|
||||
|
||||
/// Write the coordinates of all grid points.
|
||||
void WritePointCoordinates(std::ostream& file,
|
||||
const GRID2D_POINTS3D& grid2D) const;
|
||||
|
||||
/// Write the grid quadrilaterals.
|
||||
void WriteQuadrilaterals(std::ostream& file,
|
||||
const GRID2D_POINTS3D& grid2D) const;
|
||||
|
||||
/// Write grid2D to an open Geomview .off file stream.
|
||||
void Write(std::ostream& file,
|
||||
const GRID2D_POINTS3D& grid2D,
|
||||
const std::vector<std::string>& comment_list) const;
|
||||
|
||||
/// Open filename and write grid2D in Geomview .off format.
|
||||
void OpenAndWrite(const std::string& filename,
|
||||
const GRID2D_POINTS3D& grid2D,
|
||||
const std::vector<std::string>& comment_list) const;
|
||||
};
|
||||
|
||||
#endif // WRITE_GRID2D_OFF_H
|
||||
Reference in New Issue
Block a user