changed: use ASM(mx)u(Cube|Square) in TestLRSplineField(s)
similar to the tensor spline tests
This commit is contained in:
parent
66bac83978
commit
475bf496c9
@ -34,7 +34,7 @@ public:
|
||||
"[0, 1] x 1 (2)\n"
|
||||
"# Elements:\n"
|
||||
"0 [2] : (0, 0) x (1, 1) {0, 1, 2, 3}\n";
|
||||
explicit ASMuSquare()
|
||||
explicit ASMuSquare(unsigned char n_f = 2) : ASMu2D(2,n_f)
|
||||
{
|
||||
std::stringstream geo("200 1 0 0\n2 0\n2 2\n0 0 1 1\n2 2\n0 0 1 1\n0 0\n1 0\n0 1\n1 1\n");
|
||||
this->read(geo);
|
||||
|
@ -12,21 +12,21 @@
|
||||
|
||||
#include "Field.h"
|
||||
#include "FiniteElement.h"
|
||||
#include "IFEM.h"
|
||||
#include "SIM2D.h"
|
||||
#include "SIM3D.h"
|
||||
#include "ASMuCube.h"
|
||||
#include "ASMuSquare.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
TEST(TestLRSplineField, Value2D)
|
||||
{
|
||||
IFEM::getOptions().discretization = ASM::LRSpline;
|
||||
SIM2D sim(1);
|
||||
sim.createDefaultModel();
|
||||
ASMuSquare patch(1);
|
||||
EXPECT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0}; // x + y
|
||||
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
||||
std::unique_ptr<Field> fscalar(Field::create(&patch, sc));
|
||||
static std::vector<std::array<double,3>> tests_scalar = {{{0.5, 0.5, 1.0}},
|
||||
{{1.0, 0.0, 1.0}},
|
||||
{{0.0, 1.0, 1.0}},
|
||||
@ -42,12 +42,11 @@ TEST(TestLRSplineField, Value2D)
|
||||
|
||||
TEST(TestLRSplineField, Grad2D)
|
||||
{
|
||||
IFEM::getOptions().discretization = ASM::LRSpline;
|
||||
SIM2D sim(1);
|
||||
sim.createDefaultModel();
|
||||
ASMuSquare patch(1);
|
||||
EXPECT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0}; // x + y
|
||||
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
||||
std::unique_ptr<Field> fscalar(Field::create(&patch, sc));
|
||||
static std::vector<std::array<double,2>> tests_scalar = {{{0.5, 0.5}},
|
||||
{{1.0, 0.0}},
|
||||
{{0.0, 1.0}},
|
||||
@ -66,12 +65,11 @@ TEST(TestLRSplineField, Grad2D)
|
||||
|
||||
TEST(TestLRSplineField, Value3D)
|
||||
{
|
||||
IFEM::getOptions().discretization = ASM::LRSpline;
|
||||
SIM3D sim(1);
|
||||
sim.createDefaultModel();
|
||||
ASMuCube patch(1);
|
||||
EXPECT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0, 1.0, 2.0, 2.0, 3.0}; // x + y + z
|
||||
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
||||
std::unique_ptr<Field> fscalar(Field::create(&patch, sc));
|
||||
static std::vector<std::array<double,4>> tests_scalar = {{{0.5, 0.5, 0.5, 1.5}},
|
||||
{{0.0, 0.0, 0.0, 0.0}},
|
||||
{{1.0, 0.0, 0.0, 1.0}},
|
||||
@ -93,12 +91,11 @@ TEST(TestLRSplineField, Value3D)
|
||||
|
||||
TEST(TestLRSplineField, Grad3D)
|
||||
{
|
||||
IFEM::getOptions().discretization = ASM::LRSpline;
|
||||
SIM3D sim(1);
|
||||
sim.createDefaultModel();
|
||||
ASMuCube patch(1);
|
||||
EXPECT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0, 1.0, 2.0, 2.0, 3.0}; // x + y + z
|
||||
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
||||
std::unique_ptr<Field> fscalar(Field::create(&patch, sc));
|
||||
static std::vector<std::array<double,3>> tests_scalar = {{{0.5, 0.5, 0.5}},
|
||||
{{0.0, 0.0, 0.0}},
|
||||
{{1.0, 0.0, 0.0}},
|
||||
|
@ -14,28 +14,27 @@
|
||||
#include "Fields.h"
|
||||
#include "FiniteElement.h"
|
||||
#include "ASMmxBase.h"
|
||||
#include "IFEM.h"
|
||||
#include "SIM2D.h"
|
||||
#include "SIM3D.h"
|
||||
#include "ASMuCube.h"
|
||||
#include "ASMuSquare.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
TEST(TestLRSplineFields, Value2D)
|
||||
{
|
||||
IFEM::getOptions().discretization = ASM::LRSpline;
|
||||
SIM2D sim(2);
|
||||
ASSERT_TRUE(sim.createDefaultModel());
|
||||
ASMuSquare patch;
|
||||
EXPECT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
// {x+y+x*y, x-y+x*y}
|
||||
std::vector<double> vc = {0.0, 0.0,
|
||||
1.0, 1.0,
|
||||
1.0, -1.0,
|
||||
3.0, 1.0};
|
||||
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
||||
Field* fscalar = Field::create(sim.getPatch(1), vc, 1, 2);
|
||||
std::unique_ptr<Fields> fvector(Fields::create(&patch, vc));
|
||||
std::unique_ptr<Field> fscalar(Field::create(&patch, vc, 1, 2));
|
||||
static std::vector<std::array<double,4>> tests_vector =
|
||||
{{{0.5, 0.5, 1.25, 0.25}},
|
||||
{{1.0, 0.0, 1.0, 1.0}},
|
||||
@ -57,10 +56,8 @@ TEST(TestLRSplineFields, Value2D)
|
||||
TEST(TestLRSplineFields, Value2Dmx)
|
||||
{
|
||||
ASMmxBase::Type = ASMmxBase::DIV_COMPATIBLE;
|
||||
IFEM::getOptions().discretization = ASM::LRSpline;
|
||||
SIM2D sim({1,1,1});
|
||||
ASSERT_TRUE(sim.createDefaultModel());
|
||||
ASSERT_TRUE(sim.createFEMmodel());
|
||||
ASMmxuSquare patch({1,1,1});
|
||||
EXPECT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
// {x+y+x*y, x-y+x*y}
|
||||
std::vector<double> vc = {0.0,
|
||||
@ -78,8 +75,8 @@ TEST(TestLRSplineFields, Value2Dmx)
|
||||
1.0,
|
||||
// p
|
||||
0.0, 1.0, 1.0, 2.0}; // x + y
|
||||
Fields* fvector = Fields::create(sim.getPatch(1), vc, 12);
|
||||
Field* fscalar = Field::create(sim.getPatch(1), vc, 3, 1);
|
||||
std::unique_ptr<Fields> fvector(Fields::create(&patch, vc, 12));
|
||||
std::unique_ptr<Field> fscalar(Field::create(&patch, vc, 3, 1));
|
||||
static std::vector<std::array<double,5>> tests_vector =
|
||||
{{{0.5, 0.5, 1.25, 0.25, 1.0}},
|
||||
{{1.0, 0.0, 1.0, 1.0, 1.0}},
|
||||
@ -100,13 +97,12 @@ TEST(TestLRSplineFields, Value2Dmx)
|
||||
|
||||
TEST(TestLRSplineFields, Grad2D)
|
||||
{
|
||||
IFEM::getOptions().discretization = ASM::LRSpline;
|
||||
SIM2D sim(2);
|
||||
ASSERT_TRUE(sim.createDefaultModel());
|
||||
ASMuSquare patch;
|
||||
EXPECT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
// {x+y+x*y, x-y+x*y}
|
||||
std::vector<double> vc = {0.0, 0.0, 1.0, 1.0, 1.0, -1.0, 3.0, 1.0};
|
||||
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
||||
std::unique_ptr<Fields> fvector(Fields::create(&patch, vc));
|
||||
static std::vector<std::array<double,6>> tests_vector =
|
||||
{{{0.5, 0.5, 1.5, 1.5, 1.5, -0.5}},
|
||||
{{1.0, 0.0, 1.0, 2.0, 1.0, 0.0}},
|
||||
@ -128,9 +124,8 @@ TEST(TestLRSplineFields, Grad2D)
|
||||
|
||||
TEST(TestLRSplineFields, Value3D)
|
||||
{
|
||||
IFEM::getOptions().discretization = ASM::LRSpline;
|
||||
SIM3D sim(3);
|
||||
ASSERT_TRUE(sim.createDefaultModel());
|
||||
ASMuCube patch;
|
||||
EXPECT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
// {x+y+z, x+y-z, x-y+z}
|
||||
std::vector<double> vc = {0.0, 0.0, 0.0,
|
||||
@ -141,8 +136,8 @@ TEST(TestLRSplineFields, Value3D)
|
||||
2.0, 0.0, 2.0,
|
||||
2.0, 0.0, 0.0,
|
||||
3.0, 1.0, 1.0};
|
||||
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
||||
Field* fscalar = Field::create(sim.getPatch(1), vc, 1, 2);
|
||||
std::unique_ptr<Fields> fvector(Fields::create(&patch, vc));
|
||||
std::unique_ptr<Field> fscalar(Field::create(&patch, vc, 1, 2));
|
||||
static std::vector<std::array<double,6>> tests_scalar =
|
||||
{{{0.5, 0.5, 0.5, 1.5, 0.5, 0.5}},
|
||||
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}},
|
||||
@ -170,9 +165,8 @@ TEST(TestLRSplineFields, Value3D)
|
||||
|
||||
TEST(TestLRSplineFields, Grad3D)
|
||||
{
|
||||
IFEM::getOptions().discretization = ASM::LRSpline;
|
||||
SIM3D sim(3);
|
||||
ASSERT_TRUE(sim.createDefaultModel());
|
||||
ASMuCube patch;
|
||||
EXPECT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
// {x+y+z+x*y*z, x+y-z+x*y*z, x-y+z+x*y*z}
|
||||
std::vector<double> vc = {0.0, 0.0, 0.0,
|
||||
@ -183,7 +177,7 @@ TEST(TestLRSplineFields, Grad3D)
|
||||
2.0, 0.0, 2.0,
|
||||
2.0, 0.0, 0.0,
|
||||
4.0, 2.0, 2.0};
|
||||
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
||||
std::unique_ptr<Fields> fvector(Fields::create(&patch, vc));
|
||||
static std::vector<std::pair<std::array<double,3>,
|
||||
std::array<double,9>>> tests_vector =
|
||||
{{{{0.5, 0.5, 0.5}}, {{1.25, 1.25, 1.25,
|
||||
@ -230,9 +224,8 @@ TEST(TestLRSplineFields, Grad3D)
|
||||
TEST(TestLRSplineFields, Value3Dmx)
|
||||
{
|
||||
ASMmxBase::Type = ASMmxBase::DIV_COMPATIBLE;
|
||||
SIM3D sim({1,1,1,1});
|
||||
ASSERT_TRUE(sim.createDefaultModel());
|
||||
ASSERT_TRUE(sim.createFEMmodel());
|
||||
ASMmxuCube patch({1,1,1,1});
|
||||
ASSERT_TRUE(patch.generateFEMTopology());
|
||||
|
||||
// {x+y+z+x*y*z, x+y-z+x*y*z, x-y+z+x*y*z}
|
||||
std::vector<double> vc = {0.0, 0.5, 1.0,
|
||||
@ -255,8 +248,8 @@ TEST(TestLRSplineFields, Value3Dmx)
|
||||
0.0, 2.0,
|
||||
// p
|
||||
0.0, 1.0, 1.0, 2.0, 1.0, 2.0, 2.0, 3.0};
|
||||
Fields* fvector = Fields::create(sim.getPatch(1), vc, 123);
|
||||
Field* fscalar = Field::create(sim.getPatch(1), vc, 4, 1);
|
||||
std::unique_ptr<Fields> fvector(Fields::create(&patch, vc, 123));
|
||||
std::unique_ptr<Field> fscalar(Field::create(&patch, vc, 4, 1));
|
||||
static std::vector<std::array<double,7>> tests_vector =
|
||||
{{{0.5, 0.5, 0.5, 1.625, 0.625, 0.625, 1.5}},
|
||||
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}},
|
||||
|
Loading…
Reference in New Issue
Block a user