You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
7.2 KiB

7 months ago
#include <array>
#include <bitset>
#include <iostream>
#include <booluarray.hpp>
#include <cstddef>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include "bernstein.hpp"
#include "multiloop.hpp"
#include "quadrature_multipoly.hpp"
#include "binomial.hpp"
#include "real.hpp"
#include "uvector.hpp"
#include "vector"
#include "xarray.hpp"
#include <chrono>
#include <memory>
#include "organizer/primitive.hpp"
#include "organizer/organizer.hpp"
using namespace algoim::Organizer;
using namespace algoim;
7 months ago
void casePolyhedron1()
7 months ago
{
// std::vector<std::shared_ptr<PrimitiveDesc>> ps;
7 months ago
// mesh
std::vector<uvector3> vertices = {uvector3(-0.8, -0.8, -0.8),
uvector3(-0.8, -0.8, 0.8),
uvector3(-0.8, 0.8, -0.8),
uvector3(-0.8, 0.8, 0.8),
uvector3(0.8, -0.8, -0.8),
uvector3(0.8, -0.8, 0.8),
uvector3(0.8, 0.8, -0.8),
7 months ago
uvector3(0.8, 0.8, 0.8)};
std::vector<int> indices = {3, 2, 0, 1, // left
4, 6, 7, 5, // right
6, 2, 3, 7, // top
1, 0, 4, 5, // bottom
7, 3, 1, 5, // front
2, 6, 4, 0}; // back
std::vector<int> scan = {4, 8, 12, 16, 20, 24};
// ps.emplace_back(std::make_shared<MeshDesc>(vertices, indices, scan));
// ps.emplace_back(std::make_shared<SphereDesc>(0.8, 0., 1.));
// ps.emplace_back(std::make_shared<PowerTensor>(makeSphere(0.2)));
// ps.emplace_back(std::make_shared<MeshDesc>(MeshDesc(vertices, indices, scan)));
basicTask(std::make_shared<MeshDesc>(MeshDesc(vertices, indices, scan)));
7 months ago
}
7 months ago
7 months ago
void casePolyhedron2()
{
// std::vector<std::shared_ptr<PrimitiveDesc>> ps;
// mesh
std::vector<uvector3> vertices = {uvector3(-0.8, -0.8, -0.8),
uvector3(-0.8, -0.8, 0.8),
uvector3(-0.8, 0.8, -0.8),
uvector3(-0.8, 0.8, 0.8),
uvector3(0.8, -0.8, -0.8),
uvector3(0.8, -0.8, 0.8),
uvector3(0.8, 0.8, -0.8),
uvector3(0.8, 0.8, 0.8)};
std::vector<int> indices = {
3,
2,
0,
1, // left
6,
2,
3,
7 // top
7 months ago
};
7 months ago
std::vector<int> scan = {4, 8};
7 months ago
7 months ago
// ps.emplace_back(std::make_shared<MeshDesc>(vertices, indices, scan));
// ps.emplace_back(std::make_shared<SphereDesc>(0.8, 0., 1.));
7 months ago
// ps.emplace_back(std::make_shared<PowerTensor>(makeSphere(0.2)));
// ps.emplace_back(std::make_shared<MeshDesc>(MeshDesc(vertices, indices, scan)));
basicTask(std::make_shared<MeshDesc>(MeshDesc(vertices, indices, scan)));
7 months ago
}
void casePolyhedron3()
{
std::vector<std::shared_ptr<PrimitiveDesc>> primitiveDescriptions;
// std::vector<uvector3> vertices = {uvector3(-1.6, 0, 0),
// uvector3(-1.6, 0, 1.6),
// uvector3(-1.6, 1.6, 0),
// uvector3(-1.6, 1.6, 1.6),
// uvector3(1.6, 0, 0),
// uvector3(1.6, 0, 1.6),
// uvector3(1.6, 1.6, 0),
// uvector3(1.6, 1.6, 1.6)};
std::vector<uvector3> vertices = {uvector3(-0.8, -0.8, -0.8),
uvector3(-0.8, -0.8, 0.8),
uvector3(-0.8, 0.8, -0.8),
uvector3(-0.8, 0.8, 0.8),
uvector3(0.8, -0.8, -0.8),
uvector3(0.8, -0.8, 0.8),
uvector3(0.8, 0.8, -0.8),
uvector3(0.8, 0.8, 0.8)};
std::vector<int> indices = {3,
2,
0,
1, // left
6,
2,
3,
7, // top
// 7,
// 3,
// 1,
// 5, // front
2,
6,
4,
0}; // back
std::vector<int> scan = {4, 8, 12};
basicTask(std::make_shared<MeshDesc>(MeshDesc(vertices, indices, scan)));
}
void casePolyhedronSphere()
7 months ago
{
// PI * r^3 / 6
auto phi0 = std::make_shared<SphereDesc>(SphereDesc(0.8, uvector3(-0.8, 0.8, -0.8), 1.));
std::vector<uvector3> vertices = {uvector3(-0.8, -0.8, -0.8),
uvector3(-0.8, -0.8, 0.8),
uvector3(-0.8, 0.8, -0.8),
uvector3(-0.8, 0.8, 0.8),
uvector3(0.8, -0.8, -0.8),
uvector3(0.8, -0.8, 0.8),
uvector3(0.8, 0.8, -0.8),
uvector3(0.8, 0.8, 0.8)};
std::vector<int> indices = {3,
2,
0,
1, // left
6,
2,
3,
7, // top
2,
6,
4,
0}; // back
std::vector<int> scan = {4, 8, 12};
std::vector<std::shared_ptr<PrimitiveDesc>> primitiveDescriptions(2);
primitiveDescriptions[0] = phi0;
primitiveDescriptions[1] = std::make_shared<MeshDesc>(MeshDesc(vertices, indices, scan));
basicTask(primitiveDescriptions);
7 months ago
}
void testPrimitive()
{
casePolyhedron1();
// casePolyhedronSphere();
}