fix: tests

This commit is contained in:
parker
2025-08-17 22:19:53 +01:00
parent d206868e8b
commit caf1510d11
7 changed files with 64 additions and 2 deletions

View File

@@ -42,6 +42,30 @@ unsigned int ga::Attribute::Attribute::getTypeSize() const
}
void ga::Attribute::resize(size_t size)
{
using namespace enzo::ga;
switch(type_)
{
case AttributeType::intT:
intStore_->resize(size);
break;
case AttributeType::floatT:
floatStore_->resize(size);
break;
case AttributeType::boolT:
boolStore_->resize(size);
break;
case AttributeType::vectorT:
vector3Store_->resize(size);
break;
default:
throw std::runtime_error("type not accounted for");
}
}
ga::Attribute::Attribute(const Attribute& other)
{

View File

@@ -24,6 +24,7 @@ namespace enzo{
std::string getName() const;
unsigned int getTypeSize() const;
void resize(size_t size);
template <typename T>

View File

@@ -66,6 +66,38 @@ enzo::geo::Geometry& enzo::geo::Geometry::operator=(const enzo::geo::Geometry& r
return *this;
}
// void geo::Geometry::merge(Geometry& other)
// {
// pointAttributes_.reserve(pointAttributes_.size()+other.pointAttributes_.size());
// ga::Offset attributeSize = getNumPoints();
// // add each other attribute to self
// for(std::shared_ptr<ga::Attribute> otherAttribute : other.pointAttributes_)
// {
// bt::String otherAttributeName = otherAttribute->getName();
// bool alreadyExists = false;
// for(std::shared_ptr<ga::Attribute> attribute : pointAttributes_)
// {
// if(otherAttributeName == attribute->getName())
// {
// alreadyExists = true;
// break;
// }
// }
// if(alreadyExists)
// {
// for
// }
// else
// {
// otherAttribute->resize(attributeSize);
// }
//
// }
// }
void geo::Geometry::addFace(const std::vector<ga::Offset>& pointOffsets, bool closed)
{
const ga::Offset primNum = vertexCountHandlePrim_.getSize();

View File

@@ -72,6 +72,8 @@ public:
bt::boolT isClosed(ga::Offset primOffset) const;
void merge(Geometry& other);
void computePrimStartVertices() const;
private:
using attribVector = std::vector<std::shared_ptr<ga::Attribute>>;