Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Source/EBGeometry_PLY.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ class PLY
@return m_vertexProperties at provided property
*/
std::vector<T>&
getVertexProperties(const std::string a_property) noexcept;
getVertexProperties(const std::string a_property);

/*!
@brief Get the vertex properties
@param[in] a_property Which property to fetch
@note Function will fail if the property does not exist
@note Function will fail if the property does not exist
@return m_vertexProperties at provided property
*/
const std::vector<T>&
getVertexProperties(const std::string a_property) const noexcept;
getVertexProperties(const std::string a_property) const;

/*!
@brief Get the face properties
Expand All @@ -103,7 +103,7 @@ class PLY
@return m_faceProperties at provided property
*/
std::vector<T>&
getFaceProperties(const std::string a_property) noexcept;
getFaceProperties(const std::string a_property);

/*!
@brief Get the vertex properties
Expand All @@ -112,23 +112,23 @@ class PLY
@return m_vertexProperties at provided property
*/
const std::vector<T>&
getFaceProperties(const std::string a_property) const noexcept;
getFaceProperties(const std::string a_property) const;

/*!
@brief Set vertex properties
@param[in] a_property Property name
@param[in] a_data Property data
*/
void
setVertexProperties(const std::string a_property, const std::vector<T>& a_data) noexcept;
setVertexProperties(const std::string a_property, const std::vector<T>& a_data);

/*!
@brief Set face properties
@param[in] a_property Property name
@param[in] a_data Property data
*/
void
setFaceProperties(const std::string a_property, const std::vector<T>& a_data) noexcept;
setFaceProperties(const std::string a_property, const std::vector<T>& a_data);

/*!
@brief Turn the PLY mesh into a DCEL mesh.
Expand All @@ -139,7 +139,7 @@ class PLY
std::shared_ptr<EBGeometry::DCEL::MeshT<T, Meta>>
convertToDCEL() const noexcept;

protected:
//protected:
/*!
@brief PLY object ID.
*/
Expand Down
12 changes: 6 additions & 6 deletions Source/EBGeometry_PLYImplem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,42 +80,42 @@ PLY<T>::getFacets() const noexcept

template <typename T>
std::vector<T>&
PLY<T>::getVertexProperties(const std::string a_property) noexcept
PLY<T>::getVertexProperties(const std::string a_property)
{
return m_vertexProperties.at(a_property);
}

template <typename T>
const std::vector<T>&
PLY<T>::getVertexProperties(const std::string a_property) const noexcept
PLY<T>::getVertexProperties(const std::string a_property) const
{
return m_vertexProperties.at(a_property);
}

template <typename T>
std::vector<T>&
PLY<T>::getFaceProperties(const std::string a_property) noexcept
PLY<T>::getFaceProperties(const std::string a_property)
{
return m_faceProperties.at(a_property);
}

template <typename T>
const std::vector<T>&
PLY<T>::getFaceProperties(const std::string a_property) const noexcept
PLY<T>::getFaceProperties(const std::string a_property) const
{
return m_faceProperties.at(a_property);
}

template <typename T>
void
PLY<T>::setVertexProperties(const std::string a_property, const std::vector<T>& a_data) noexcept
PLY<T>::setVertexProperties(const std::string a_property, const std::vector<T>& a_data)
{
m_vertexProperties[a_property] = a_data;
}

template <typename T>
void
PLY<T>::setFaceProperties(const std::string a_property, const std::vector<T>& a_data) noexcept
PLY<T>::setFaceProperties(const std::string a_property, const std::vector<T>& a_data)
{
m_faceProperties[a_property] = a_data;
}
Expand Down
56 changes: 52 additions & 4 deletions Source/EBGeometry_ParserImplem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,11 @@ Parser::readPLY(const std::string& a_filename) noexcept
}
}

// Copy properties to PLY object using the setter methods
// Copy properties to PLY object using the setter methods, skipping x/y/z coordinates
for (const auto& propName : vertexPropertyNames) {
ply.setVertexProperties(propName, vertexProps[propName]);
if (propName != "x" && propName != "y" && propName != "z") {
ply.setVertexProperties(propName, vertexProps[propName]);
}
}

for (const auto& propName : facePropertyNames) {
Expand Down Expand Up @@ -835,9 +837,11 @@ Parser::readPLY(const std::string& a_filename) noexcept
}
}

// Copy properties to PLY object using the setter methods
// Copy properties to PLY object using the setter methods, skipping x/y/z coordinates
for (const auto& propName : vertexPropertyNames) {
ply.setVertexProperties(propName, vertexProps[propName]);
if (propName != "x" && propName != "y" && propName != "z") {
ply.setVertexProperties(propName, vertexProps[propName]);
}
}

for (const auto& propName : facePropertyNames) {
Expand Down Expand Up @@ -889,6 +893,7 @@ Parser::readVTK(const std::string& a_filename) noexcept
case Parser::Encoding::ASCII: {
std::ifstream filestream(a_filename);

std::cout << "reading ascii" << std::endl;
if (filestream.is_open()) {
std::string line;

Expand Down Expand Up @@ -1025,6 +1030,8 @@ Parser::readVTK(const std::string& a_filename) noexcept
size_t numData;
sstream >> numData;

std::cout << "getting point data" << std::endl;

// Read point data arrays
while (std::getline(filestream, line)) {
std::stringstream ss(line);
Expand Down Expand Up @@ -1062,6 +1069,23 @@ Parser::readVTK(const std::string& a_filename) noexcept

vtk.setPointDataScalars(arrayName, scalarData);
}
else if (dataKeyword == "FIELD") {
// Skip FIELD arrays within POINT_DATA
std::string fieldName;
size_t numArrays;
ss >> fieldName >> numArrays;
for (size_t f = 0; f < numArrays; f++) {
std::string fieldArrayName, dataType;
size_t numComponents, numTuples;
filestream >> fieldArrayName >> numComponents >> numTuples >> dataType;
std::getline(filestream, line);
for (size_t v = 0; v < numComponents * numTuples; v++) {
std::string dummy;
filestream >> dummy;
}
std::getline(filestream, line);
}
}
else if (dataKeyword == "CELL_DATA") {
// Back up - we've hit the next section
filestream.seekg(-static_cast<int>(line.length()) - 1, std::ios_base::cur);
Expand Down Expand Up @@ -1109,6 +1133,28 @@ Parser::readVTK(const std::string& a_filename) noexcept

vtk.setCellDataScalars(arrayName, scalarData);
}
else if (dataKeyword == "FIELD") {
// Skip FIELD arrays within CELL_DATA
std::string fieldName;
size_t numArrays;
ss >> fieldName >> numArrays;
for (size_t f = 0; f < numArrays; f++) {
std::string fieldArrayName, dataType;
size_t numComponents, numTuples;
filestream >> fieldArrayName >> numComponents >> numTuples >> dataType;
std::getline(filestream, line);
for (size_t v = 0; v < numComponents * numTuples; v++) {
std::string dummy;
filestream >> dummy;
}
std::getline(filestream, line);
}
}
else if (dataKeyword == "POINT_DATA") {
// Back up - we've hit the next section
filestream.seekg(-static_cast<int>(line.length()) - 1, std::ios_base::cur);
break;
}
}
}
}
Expand Down Expand Up @@ -1311,6 +1357,8 @@ Parser::readVTK(const std::string& a_filename) noexcept
size_t numData;
sstream >> numData;

std::cout << "getting point data" << std::endl;

// Read point data arrays
while (std::getline(filestream, line)) {
std::stringstream ss(line);
Expand Down
14 changes: 7 additions & 7 deletions Source/EBGeometry_VTK.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class VTK
@return m_pointDataScalars at provided name
*/
std::vector<T>&
getPointDataScalars(const std::string a_name) noexcept;
getPointDataScalars(const std::string a_name);

/*!
@brief Get the point data scalars
Expand All @@ -95,7 +95,7 @@ class VTK
@return m_pointDataScalars at provided name
*/
const std::vector<T>&
getPointDataScalars(const std::string a_name) const noexcept;
getPointDataScalars(const std::string a_name) const;

/*!
@brief Get the cell data scalars
Expand All @@ -104,7 +104,7 @@ class VTK
@return m_cellDataScalars at provided name
*/
std::vector<T>&
getCellDataScalars(const std::string a_name) noexcept;
getCellDataScalars(const std::string a_name);

/*!
@brief Get the cell data scalars
Expand All @@ -113,23 +113,23 @@ class VTK
@return m_cellDataScalars at provided name
*/
const std::vector<T>&
getCellDataScalars(const std::string a_name) const noexcept;
getCellDataScalars(const std::string a_name) const;

/*!
@brief Set point data scalars
@param[in] a_name Array name
@param[in] a_data Array data
*/
void
setPointDataScalars(const std::string a_name, const std::vector<T>& a_data) noexcept;
setPointDataScalars(const std::string a_name, const std::vector<T>& a_data);

/*!
@brief Set cell data scalars
@param[in] a_name Array name
@param[in] a_data Array data
*/
void
setCellDataScalars(const std::string a_name, const std::vector<T>& a_data) noexcept;
setCellDataScalars(const std::string a_name, const std::vector<T>& a_data);

/*!
@brief Turn the VTK mesh into a DCEL mesh.
Expand All @@ -140,7 +140,7 @@ class VTK
std::shared_ptr<EBGeometry::DCEL::MeshT<T, Meta>>
convertToDCEL() const noexcept;

protected:
//protected:
/*!
@brief VTK object ID.
*/
Expand Down
12 changes: 6 additions & 6 deletions Source/EBGeometry_VTKImplem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,42 +80,42 @@ VTK<T>::getFacets() const noexcept

template <typename T>
std::vector<T>&
VTK<T>::getPointDataScalars(const std::string a_name) noexcept
VTK<T>::getPointDataScalars(const std::string a_name)
{
return m_pointDataScalars.at(a_name);
}

template <typename T>
const std::vector<T>&
VTK<T>::getPointDataScalars(const std::string a_name) const noexcept
VTK<T>::getPointDataScalars(const std::string a_name) const
{
return m_pointDataScalars.at(a_name);
}

template <typename T>
std::vector<T>&
VTK<T>::getCellDataScalars(const std::string a_name) noexcept
VTK<T>::getCellDataScalars(const std::string a_name)
{
return m_cellDataScalars.at(a_name);
}

template <typename T>
const std::vector<T>&
VTK<T>::getCellDataScalars(const std::string a_name) const noexcept
VTK<T>::getCellDataScalars(const std::string a_name) const
{
return m_cellDataScalars.at(a_name);
}

template <typename T>
void
VTK<T>::setPointDataScalars(const std::string a_name, const std::vector<T>& a_data) noexcept
VTK<T>::setPointDataScalars(const std::string a_name, const std::vector<T>& a_data)
{
m_pointDataScalars[a_name] = a_data;
}

template <typename T>
void
VTK<T>::setCellDataScalars(const std::string a_name, const std::vector<T>& a_data) noexcept
VTK<T>::setCellDataScalars(const std::string a_name, const std::vector<T>& a_data)
{
m_cellDataScalars[a_name] = a_data;
}
Expand Down