fix: tests
This commit is contained in:
@@ -202,6 +202,7 @@ target_include_directories(${TestExec} PUBLIC
|
|||||||
${ENGINE_INCLUDE_DIRECTORIES}
|
${ENGINE_INCLUDE_DIRECTORIES}
|
||||||
${BOOST_INCLUDE_DIRS}
|
${BOOST_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
target_compile_definitions(${TestExec} PRIVATE ENZO_DEV_LIB_DIR="${ENZO_DEV_LIB_DIR}")
|
||||||
|
|
||||||
# benchmarks
|
# benchmarks
|
||||||
add_executable(${BenchExec}
|
add_executable(${BenchExec}
|
||||||
@@ -214,4 +215,5 @@ target_compile_definitions(${BenchExec} PRIVATE UNIT_TEST)
|
|||||||
target_include_directories(${BenchExec} PUBLIC
|
target_include_directories(${BenchExec} PUBLIC
|
||||||
${ENGINE_INCLUDE_DIRECTORIES}
|
${ENGINE_INCLUDE_DIRECTORIES}
|
||||||
)
|
)
|
||||||
|
target_compile_definitions(${BenchExec} PRIVATE ENZO_DEV_LIB_DIR="${ENZO_DEV_LIB_DIR}")
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
ga::Attribute::Attribute(const Attribute& other)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace enzo{
|
|||||||
std::string getName() const;
|
std::string getName() const;
|
||||||
unsigned int getTypeSize() const;
|
unsigned int getTypeSize() const;
|
||||||
|
|
||||||
|
void resize(size_t size);
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
@@ -66,6 +66,38 @@ enzo::geo::Geometry& enzo::geo::Geometry::operator=(const enzo::geo::Geometry& r
|
|||||||
return *this;
|
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)
|
void geo::Geometry::addFace(const std::vector<ga::Offset>& pointOffsets, bool closed)
|
||||||
{
|
{
|
||||||
const ga::Offset primNum = vertexCountHandlePrim_.getSize();
|
const ga::Offset primNum = vertexCountHandlePrim_.getSize();
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ public:
|
|||||||
|
|
||||||
bt::boolT isClosed(ga::Offset primOffset) const;
|
bt::boolT isClosed(ga::Offset primOffset) const;
|
||||||
|
|
||||||
|
void merge(Geometry& other);
|
||||||
|
|
||||||
void computePrimStartVertices() const;
|
void computePrimStartVertices() const;
|
||||||
private:
|
private:
|
||||||
using attribVector = std::vector<std::shared_ptr<ga::Attribute>>;
|
using attribVector = std::vector<std::shared_ptr<ga::Attribute>>;
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ struct OperatorTableInit
|
|||||||
OperatorTableInit() { enzo::op::OperatorTable::initPlugins(); }
|
OperatorTableInit() { enzo::op::OperatorTable::initPlugins(); }
|
||||||
};
|
};
|
||||||
static OperatorTableInit _operatorTableInit;
|
static OperatorTableInit _operatorTableInit;
|
||||||
auto testOpInfo = enzo::op::OperatorTable::getOpInfo("house").value();
|
auto testOpInfoOptional = enzo::op::OperatorTable::getOpInfo("grid");
|
||||||
|
auto testOpInfo = testOpInfoOptional.value();
|
||||||
|
|
||||||
TEST_CASE_METHOD(NMReset, "network fixture separation start")
|
TEST_CASE_METHOD(NMReset, "network fixture separation start")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ TEST_CASE("geometry")
|
|||||||
|
|
||||||
// check getter
|
// check getter
|
||||||
std::shared_ptr<ga::Attribute> myAttribute = geo.getAttribByName(ga::AttrOwner::POINT, "index");
|
std::shared_ptr<ga::Attribute> myAttribute = geo.getAttribByName(ga::AttrOwner::POINT, "index");
|
||||||
ga::AttributeHandle<int> myHandle2(myAttribute);
|
ga::AttributeHandle<bt::intT> myHandle2(myAttribute);
|
||||||
REQUIRE(myHandle2.getValue(0)==5);
|
REQUIRE(myHandle2.getValue(0)==5);
|
||||||
REQUIRE(myHandle2.getValue(1)==6);
|
REQUIRE(myHandle2.getValue(1)==6);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user