34 #ifndef AIMS_IO_PLYW_H 35 #define AIMS_IO_PLYW_H 50 template<
long D,
typename T>
54 PlyWriter(
const std::string& name,
bool ascii =
false )
55 : _name( name ), _ascii( ascii )
69 template <
long D,
typename T>
73 writer.write( thing );
78 template <
long D,
typename T>
92 hdr.
setProperty(
"file_type", std::string(
"PLY" ) );
109 if( thing.size() > 1 )
110 std::cout <<
"PlyWriter warning: only the first timestep of the " 111 <<
"surface will be writen" << std::endl;
113 const std::vector<Point3df> & vert = thing.
vertex();
114 const std::vector<Point3df> &
norm = thing.
normal();
115 const std::vector<AimsVector<uint, D> > & poly = thing.
polygon();
116 unsigned i, j, n = vert.size(), np = poly.size();
117 bool normal = (n <= norm.size() );
153 for( i=0; i<np; ++i )
158 if( !
ply_write( ply, rint( poly[i][j] ) ) )
int ply_add_list_property(p_ply ply, const char *name, e_ply_type length_type, e_ply_type value_type)
int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type)
The class for EcatSino data write operation.
enum e_ply_storage_mode_ e_ply_storage_mode
static std::string removeExtension(const std::string &)
virtual bool removeProperty(const std::string &)
static void launchErrnoExcept(const std::string &filename="")
The template class to manage a mesh with time if needed.
const std::vector< AimsVector< uint, D > > & polygon() const
Get a const reference to the vector of polygons of the 0 surface.
const std::vector< Point3df > & normal() const
Get a const reference to the vector of normals of the 0 surface.
p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, p_ply_error_cb error_cb, long idata, void *pdata)
static std::string dirname(const std::string &)
void write(const AimsTimeSurface< D, T > &thing)
PlyWriter(const std::string &name, bool ascii=false)
std::string removeExtension(const std::string &name) const
Return a name without .ply extension.
int ply_write(p_ply ply, double value)
int ply_add_element(p_ply ply, const char *name, long ninstances)
const std::vector< Point3df > & vertex() const
Get a const reference to the vector of verteces of the surface of index 0.
virtual void setProperty(const std::string &, Object)
AIMSDATA_API float norm(const Tensor &thing)
virtual bool hasProperty(const std::string &) const
int ply_write_header(p_ply ply)
const aims::PythonHeader & header() const
Get the header.