fix: array initialization for apple clang
This commit is contained in:
parent
2cc7c74163
commit
d19cb71f28
@ -16,6 +16,7 @@
|
|||||||
#include "SIM3D.h"
|
#include "SIM3D.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
|
||||||
TEST(TestSplineField, Value2D)
|
TEST(TestSplineField, Value2D)
|
||||||
@ -25,10 +26,10 @@ TEST(TestSplineField, Value2D)
|
|||||||
|
|
||||||
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0}; // x + y
|
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0}; // x + y
|
||||||
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
||||||
static std::vector<std::array<double,3>> tests_scalar = {{0.5, 0.5, 1.0},
|
static std::vector<std::array<double,3>> tests_scalar = {{{{0.5, 0.5, 1.0}},
|
||||||
{1.0, 0.0, 1.0},
|
{{1.0, 0.0, 1.0}},
|
||||||
{0.0, 1.0, 1.0},
|
{{0.0, 1.0, 1.0}},
|
||||||
{1.0, 1.0, 2.0}};
|
{{1.0, 1.0, 2.0}}}};
|
||||||
for (const auto& it : tests_scalar) {
|
for (const auto& it : tests_scalar) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it[0];
|
fe.u = it[0];
|
||||||
@ -37,7 +38,6 @@ TEST(TestSplineField, Value2D)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(TestSplineField, Grad2D)
|
TEST(TestSplineField, Grad2D)
|
||||||
{
|
{
|
||||||
SIM2D sim(1);
|
SIM2D sim(1);
|
||||||
@ -45,10 +45,10 @@ TEST(TestSplineField, Grad2D)
|
|||||||
|
|
||||||
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0}; // x + y
|
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0}; // x + y
|
||||||
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
||||||
static std::vector<std::array<double,2>> tests_scalar = {{0.5, 0.5},
|
static std::vector<std::array<double,2>> tests_scalar = {{{{0.5, 0.5}},
|
||||||
{1.0, 0.0},
|
{{1.0, 0.0}},
|
||||||
{0.0, 1.0},
|
{{0.0, 1.0}},
|
||||||
{1.0, 1.0}};
|
{{1.0, 1.0}}}};
|
||||||
for (const auto& it : tests_scalar) {
|
for (const auto& it : tests_scalar) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it[0];
|
fe.u = it[0];
|
||||||
@ -68,15 +68,15 @@ TEST(TestSplineField, Value3D)
|
|||||||
|
|
||||||
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0, 1.0, 2.0, 2.0, 3.0}; // x + y + z
|
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);
|
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
||||||
static std::vector<std::array<double,4>> tests_scalar = {{0.5, 0.5, 0.5, 1.5},
|
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},
|
{{0.0, 0.0, 0.0, 0.0}},
|
||||||
{1.0, 0.0, 0.0, 1.0},
|
{{1.0, 0.0, 0.0, 1.0}},
|
||||||
{0.0, 1.0, 0.0, 1.0},
|
{{0.0, 1.0, 0.0, 1.0}},
|
||||||
{1.0, 1.0, 0.0, 2.0},
|
{{1.0, 1.0, 0.0, 2.0}},
|
||||||
{0.0, 0.0, 1.0, 1.0},
|
{{0.0, 0.0, 1.0, 1.0}},
|
||||||
{1.0, 0.0, 1.0, 2.0},
|
{{1.0, 0.0, 1.0, 2.0}},
|
||||||
{0.0, 1.0, 1.0, 2.0},
|
{{0.0, 1.0, 1.0, 2.0}},
|
||||||
{1.0, 1.0, 1.0, 3.0}};
|
{{1.0, 1.0, 1.0, 3.0}}}};
|
||||||
for (const auto& it : tests_scalar) {
|
for (const auto& it : tests_scalar) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it[0];
|
fe.u = it[0];
|
||||||
@ -94,15 +94,15 @@ TEST(TestSplineField, Grad3D)
|
|||||||
|
|
||||||
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0, 1.0, 2.0, 2.0, 3.0}; // x + y + z
|
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);
|
Field* fscalar = Field::create(sim.getPatch(1), sc);
|
||||||
static std::vector<std::array<double,3>> tests_scalar = {{0.5, 0.5, 0.5},
|
static std::vector<std::array<double,3>> tests_scalar = {{{{0.5, 0.5, 0.5}},
|
||||||
{0.0, 0.0, 0.0},
|
{{0.0, 0.0, 0.0}},
|
||||||
{1.0, 0.0, 0.0},
|
{{1.0, 0.0, 0.0}},
|
||||||
{0.0, 1.0, 0.0},
|
{{0.0, 1.0, 0.0}},
|
||||||
{1.0, 1.0, 0.0},
|
{{1.0, 1.0, 0.0}},
|
||||||
{0.0, 0.0, 1.0},
|
{{0.0, 0.0, 1.0}},
|
||||||
{1.0, 0.0, 1.0},
|
{{1.0, 0.0, 1.0}},
|
||||||
{0.0, 1.0, 1.0},
|
{{0.0, 1.0, 1.0}},
|
||||||
{1.0, 1.0, 1.0}};
|
{{1.0, 1.0, 1.0}}}};
|
||||||
for (const auto& it : tests_scalar) {
|
for (const auto& it : tests_scalar) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it[0];
|
fe.u = it[0];
|
||||||
|
@ -35,10 +35,10 @@ TEST(TestSplineFields, Value2D)
|
|||||||
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
||||||
Field* fscalar = Field::create(sim.getPatch(1), vc, 1, 2);
|
Field* fscalar = Field::create(sim.getPatch(1), vc, 1, 2);
|
||||||
static std::vector<std::array<double,4>> tests_vector =
|
static std::vector<std::array<double,4>> tests_vector =
|
||||||
{{0.5, 0.5, 1.25, 0.25},
|
{{{{0.5, 0.5, 1.25, 0.25}},
|
||||||
{1.0, 0.0, 1.0, 1.0},
|
{{1.0, 0.0, 1.0, 1.0}},
|
||||||
{0.0, 1.0, 1.0, -1.0},
|
{{0.0, 1.0, 1.0, -1.0}},
|
||||||
{1.0, 1.0, 3.0, 1.0}};
|
{{1.0, 1.0, 3.0, 1.0}}}};
|
||||||
for (const auto& it : tests_vector) {
|
for (const auto& it : tests_vector) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it[0];
|
fe.u = it[0];
|
||||||
@ -78,10 +78,10 @@ TEST(TestSplineFields, Value2Dmx)
|
|||||||
Fields* fvector = Fields::create(sim.getPatch(1), vc, 12);
|
Fields* fvector = Fields::create(sim.getPatch(1), vc, 12);
|
||||||
Field* fscalar = Field::create(sim.getPatch(1), vc, 3, 1);
|
Field* fscalar = Field::create(sim.getPatch(1), vc, 3, 1);
|
||||||
static std::vector<std::array<double,5>> tests_vector =
|
static std::vector<std::array<double,5>> tests_vector =
|
||||||
{{0.5, 0.5, 1.25, 0.25, 1.0},
|
{{{{0.5, 0.5, 1.25, 0.25, 1.0}},
|
||||||
{1.0, 0.0, 1.0, 1.0, 1.0},
|
{{1.0, 0.0, 1.0, 1.0, 1.0}},
|
||||||
{0.0, 1.0, 1.0, -1.0, 1.0},
|
{{0.0, 1.0, 1.0, -1.0, 1.0}},
|
||||||
{1.0, 1.0, 3.0, 1.0, 2.0}};
|
{{1.0, 1.0, 3.0, 1.0, 2.0}}}};
|
||||||
for (const auto& it : tests_vector) {
|
for (const auto& it : tests_vector) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it[0];
|
fe.u = it[0];
|
||||||
@ -104,10 +104,10 @@ TEST(TestSplineFields, Grad2D)
|
|||||||
std::vector<double> vc = {0.0, 0.0, 1.0, 1.0, 1.0, -1.0, 3.0, 1.0};
|
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);
|
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
||||||
static std::vector<std::array<double,6>> tests_vector =
|
static std::vector<std::array<double,6>> tests_vector =
|
||||||
{{0.5, 0.5, 1.5, 1.5, 1.5, -0.5},
|
{{{{0.5, 0.5, 1.5, 1.5, 1.5, -0.5}},
|
||||||
{1.0, 0.0, 1.0, 2.0, 1.0, 0.0},
|
{{1.0, 0.0, 1.0, 2.0, 1.0, 0.0}},
|
||||||
{0.0, 1.0, 2.0, 1.0, 2.0, -1.0},
|
{{0.0, 1.0, 2.0, 1.0, 2.0, -1.0}},
|
||||||
{1.0, 1.0, 2.0, 2.0, 2.0, 0.0}};
|
{{1.0, 1.0, 2.0, 2.0, 2.0, 0.0}}}};
|
||||||
for (const auto& it : tests_vector) {
|
for (const auto& it : tests_vector) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it[0];
|
fe.u = it[0];
|
||||||
@ -139,15 +139,15 @@ TEST(TestSplineFields, Value3D)
|
|||||||
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
||||||
Field* fscalar = Field::create(sim.getPatch(1), vc, 1, 2);
|
Field* fscalar = Field::create(sim.getPatch(1), vc, 1, 2);
|
||||||
static std::vector<std::array<double,6>> tests_scalar =
|
static std::vector<std::array<double,6>> tests_scalar =
|
||||||
{{0.5, 0.5, 0.5, 1.5, 0.5, 0.5},
|
{{{{0.5, 0.5, 0.5, 1.5, 0.5, 0.5}},
|
||||||
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
|
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}},
|
||||||
{1.0, 0.0, 0.0, 1.0, 1.0, 1.0},
|
{{1.0, 0.0, 0.0, 1.0, 1.0, 1.0}},
|
||||||
{0.0, 1.0, 0.0, 1.0, 1.0, -1.0},
|
{{0.0, 1.0, 0.0, 1.0, 1.0, -1.0}},
|
||||||
{1.0, 1.0, 0.0, 2.0, 2.0, 0.0},
|
{{1.0, 1.0, 0.0, 2.0, 2.0, 0.0}},
|
||||||
{0.0, 0.0, 1.0, 1.0, -1.0, 1.0},
|
{{0.0, 0.0, 1.0, 1.0, -1.0, 1.0}},
|
||||||
{1.0, 0.0, 1.0, 2.0, 0.0, 2.0},
|
{{1.0, 0.0, 1.0, 2.0, 0.0, 2.0}},
|
||||||
{0.0, 1.0, 1.0, 2.0, 0.0, 0.0},
|
{{0.0, 1.0, 1.0, 2.0, 0.0, 0.0}},
|
||||||
{1.0, 1.0, 1.0, 3.0, 1.0, 1.0}};
|
{{1.0, 1.0, 1.0, 3.0, 1.0, 1.0}}}};
|
||||||
for (const auto& it : tests_scalar) {
|
for (const auto& it : tests_scalar) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it[0];
|
fe.u = it[0];
|
||||||
@ -180,33 +180,33 @@ TEST(TestSplineFields, Grad3D)
|
|||||||
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
Fields* fvector = Fields::create(sim.getPatch(1), vc);
|
||||||
static std::vector<std::pair<std::array<double,3>,
|
static std::vector<std::pair<std::array<double,3>,
|
||||||
std::array<double,9>>> tests_vector =
|
std::array<double,9>>> tests_vector =
|
||||||
{{{0.5, 0.5, 0.5}, {1.25, 1.25, 1.25,
|
{{{{{0.5, 0.5, 0.5}}, {{1.25, 1.25, 1.25,
|
||||||
1.25, 1.25, -0.75,
|
1.25, 1.25, -0.75,
|
||||||
1.25, -0.75, 1.25}},
|
1.25, -0.75, 1.25}}},
|
||||||
{{0.0, 0.0, 0.0}, {1.0, 1.0, 1.0,
|
{{{0.0, 0.0, 0.0}}, {{1.0, 1.0, 1.0,
|
||||||
1.0, 1.0, -1.0,
|
1.0, 1.0, -1.0,
|
||||||
1.0, -1.0, 1.0}},
|
1.0, -1.0, 1.0}}},
|
||||||
{{1.0, 0.0, 0.0}, {1.0, 1.0, 1.0,
|
{{{1.0, 0.0, 0.0}}, {{1.0, 1.0, 1.0,
|
||||||
1.0, 1.0, -1.0,
|
1.0, 1.0, -1.0,
|
||||||
1.0, -1.0, 1.0}},
|
1.0, -1.0, 1.0}}},
|
||||||
{{0.0, 1.0, 0.0}, {1.0, 1.0, 1.0,
|
{{{0.0, 1.0, 0.0}}, {{1.0, 1.0, 1.0,
|
||||||
1.0, 1.0, -1.0,
|
1.0, 1.0, -1.0,
|
||||||
1.0, -1.0, 1.0}},
|
1.0, -1.0, 1.0}}},
|
||||||
{{1.0, 1.0, 0.0}, {1.0, 1.0, 2.0,
|
{{{1.0, 1.0, 0.0}}, {{1.0, 1.0, 2.0,
|
||||||
1.0, 1.0, 0.0,
|
1.0, 1.0, 0.0,
|
||||||
1.0, -1.0, 2.0}},
|
1.0, -1.0, 2.0}}},
|
||||||
{{0.0, 0.0, 1.0}, {1.0, 1.0, 1.0,
|
{{{0.0, 0.0, 1.0}}, {{1.0, 1.0, 1.0,
|
||||||
1.0, 1.0, -1.0,
|
1.0, 1.0, -1.0,
|
||||||
1.0, -1.0, 1.0}},
|
1.0, -1.0, 1.0}}},
|
||||||
{{1.0, 0.0, 1.0}, {1.0, 2.0, 1.0,
|
{{{1.0, 0.0, 1.0}}, {{1.0, 2.0, 1.0,
|
||||||
1.0, 2.0, -1.0,
|
1.0, 2.0, -1.0,
|
||||||
1.0, 0.0, 1.0}},
|
1.0, 0.0, 1.0}}},
|
||||||
{{0.0, 1.0, 1.0}, {2.0, 1.0, 1.0,
|
{{{0.0, 1.0, 1.0}}, {{2.0, 1.0, 1.0,
|
||||||
2.0, 1.0, -1.0,
|
2.0, 1.0, -1.0,
|
||||||
2.0, -1.0, 1.0}},
|
2.0, -1.0, 1.0}}},
|
||||||
{{1.0, 1.0, 1.0}, {2.0, 2.0, 2.0,
|
{{{1.0, 1.0, 1.0}}, {{2.0, 2.0, 2.0,
|
||||||
2.0, 2.0, 0.0,
|
2.0, 2.0, 0.0,
|
||||||
2.0, 0.0, 2.0}}};
|
2.0, 0.0, 2.0}}}}};
|
||||||
for (const auto& it : tests_vector) {
|
for (const auto& it : tests_vector) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it.first[0];
|
fe.u = it.first[0];
|
||||||
@ -252,15 +252,15 @@ TEST(TestSplineFields, Value3Dmx)
|
|||||||
Fields* fvector = Fields::create(sim.getPatch(1), vc, 123);
|
Fields* fvector = Fields::create(sim.getPatch(1), vc, 123);
|
||||||
Field* fscalar = Field::create(sim.getPatch(1), vc, 4, 1);
|
Field* fscalar = Field::create(sim.getPatch(1), vc, 4, 1);
|
||||||
static std::vector<std::array<double,7>> tests_vector =
|
static std::vector<std::array<double,7>> tests_vector =
|
||||||
{{0.5, 0.5, 0.5, 1.625, 0.625, 0.625, 1.5},
|
{{{{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},
|
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}},
|
||||||
{1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0},
|
{{1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0}},
|
||||||
{0.0, 1.0, 0.0, 1.0, 1.0, -1.0, 1.0},
|
{{0.0, 1.0, 0.0, 1.0, 1.0, -1.0, 1.0}},
|
||||||
{1.0, 1.0, 0.0, 2.0, 2.0, 0.0, 2.0},
|
{{1.0, 1.0, 0.0, 2.0, 2.0, 0.0, 2.0}},
|
||||||
{0.0, 0.0, 1.0, 1.0, -1.0, 1.0, 1.0},
|
{{0.0, 0.0, 1.0, 1.0, -1.0, 1.0, 1.0}},
|
||||||
{1.0, 0.0, 1.0, 2.0, 0.0, 2.0, 2.0},
|
{{1.0, 0.0, 1.0, 2.0, 0.0, 2.0, 2.0}},
|
||||||
{0.0, 1.0, 1.0, 2.0, 0.0, 0.0, 2.0},
|
{{0.0, 1.0, 1.0, 2.0, 0.0, 0.0, 2.0}},
|
||||||
{1.0, 1.0, 1.0, 4.0, 2.0, 2.0, 3.0}};
|
{{1.0, 1.0, 1.0, 4.0, 2.0, 2.0, 3.0}}}};
|
||||||
for (const auto& it : tests_vector) {
|
for (const auto& it : tests_vector) {
|
||||||
FiniteElement fe;
|
FiniteElement fe;
|
||||||
fe.u = it[0];
|
fe.u = it[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user