fix: array initialization for apple clang

This commit is contained in:
timovanopstal 2017-03-14 16:49:03 +01:00 committed by Arne Morten Kvarving
parent 2cc7c74163
commit d19cb71f28
2 changed files with 84 additions and 84 deletions

View File

@ -16,6 +16,7 @@
#include "SIM3D.h"
#include "gtest/gtest.h"
#include <array>
TEST(TestSplineField, Value2D)
@ -25,10 +26,10 @@ TEST(TestSplineField, Value2D)
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0}; // x + y
Field* fscalar = Field::create(sim.getPatch(1), 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},
{1.0, 1.0, 2.0}};
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}},
{{1.0, 1.0, 2.0}}}};
for (const auto& it : tests_scalar) {
FiniteElement fe;
fe.u = it[0];
@ -37,7 +38,6 @@ TEST(TestSplineField, Value2D)
}
}
TEST(TestSplineField, Grad2D)
{
SIM2D sim(1);
@ -45,10 +45,10 @@ TEST(TestSplineField, Grad2D)
std::vector<double> sc = {0.0, 1.0, 1.0, 2.0}; // x + y
Field* fscalar = Field::create(sim.getPatch(1), sc);
static std::vector<std::array<double,2>> tests_scalar = {{0.5, 0.5},
{1.0, 0.0},
{0.0, 1.0},
{1.0, 1.0}};
static std::vector<std::array<double,2>> tests_scalar = {{{{0.5, 0.5}},
{{1.0, 0.0}},
{{0.0, 1.0}},
{{1.0, 1.0}}}};
for (const auto& it : tests_scalar) {
FiniteElement fe;
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
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},
{0.0, 0.0, 0.0, 0.0},
{1.0, 0.0, 0.0, 1.0},
{0.0, 1.0, 0.0, 1.0},
{1.0, 1.0, 0.0, 2.0},
{0.0, 0.0, 1.0, 1.0},
{1.0, 0.0, 1.0, 2.0},
{0.0, 1.0, 1.0, 2.0},
{1.0, 1.0, 1.0, 3.0}};
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}},
{{0.0, 1.0, 0.0, 1.0}},
{{1.0, 1.0, 0.0, 2.0}},
{{0.0, 0.0, 1.0, 1.0}},
{{1.0, 0.0, 1.0, 2.0}},
{{0.0, 1.0, 1.0, 2.0}},
{{1.0, 1.0, 1.0, 3.0}}}};
for (const auto& it : tests_scalar) {
FiniteElement fe;
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
Field* fscalar = Field::create(sim.getPatch(1), 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},
{0.0, 1.0, 0.0},
{1.0, 1.0, 0.0},
{0.0, 0.0, 1.0},
{1.0, 0.0, 1.0},
{0.0, 1.0, 1.0},
{1.0, 1.0, 1.0}};
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}},
{{0.0, 1.0, 0.0}},
{{1.0, 1.0, 0.0}},
{{0.0, 0.0, 1.0}},
{{1.0, 0.0, 1.0}},
{{0.0, 1.0, 1.0}},
{{1.0, 1.0, 1.0}}}};
for (const auto& it : tests_scalar) {
FiniteElement fe;
fe.u = it[0];

View File

@ -35,10 +35,10 @@ TEST(TestSplineFields, Value2D)
Fields* fvector = Fields::create(sim.getPatch(1), vc);
Field* fscalar = Field::create(sim.getPatch(1), 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},
{0.0, 1.0, 1.0, -1.0},
{1.0, 1.0, 3.0, 1.0}};
{{{{0.5, 0.5, 1.25, 0.25}},
{{1.0, 0.0, 1.0, 1.0}},
{{0.0, 1.0, 1.0, -1.0}},
{{1.0, 1.0, 3.0, 1.0}}}};
for (const auto& it : tests_vector) {
FiniteElement fe;
fe.u = it[0];
@ -78,10 +78,10 @@ TEST(TestSplineFields, Value2Dmx)
Fields* fvector = Fields::create(sim.getPatch(1), vc, 12);
Field* fscalar = Field::create(sim.getPatch(1), 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},
{0.0, 1.0, 1.0, -1.0, 1.0},
{1.0, 1.0, 3.0, 1.0, 2.0}};
{{{{0.5, 0.5, 1.25, 0.25, 1.0}},
{{1.0, 0.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}}}};
for (const auto& it : tests_vector) {
FiniteElement fe;
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};
Fields* fvector = Fields::create(sim.getPatch(1), 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},
{0.0, 1.0, 2.0, 1.0, 2.0, -1.0},
{1.0, 1.0, 2.0, 2.0, 2.0, 0.0}};
{{{{0.5, 0.5, 1.5, 1.5, 1.5, -0.5}},
{{1.0, 0.0, 1.0, 2.0, 1.0, 0.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}}}};
for (const auto& it : tests_vector) {
FiniteElement fe;
fe.u = it[0];
@ -139,15 +139,15 @@ TEST(TestSplineFields, Value3D)
Fields* fvector = Fields::create(sim.getPatch(1), vc);
Field* fscalar = Field::create(sim.getPatch(1), 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},
{1.0, 0.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},
{0.0, 0.0, 1.0, 1.0, -1.0, 1.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},
{1.0, 1.0, 1.0, 3.0, 1.0, 1.0}};
{{{{0.5, 0.5, 0.5, 1.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, 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}},
{{0.0, 0.0, 1.0, 1.0, -1.0, 1.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}},
{{1.0, 1.0, 1.0, 3.0, 1.0, 1.0}}}};
for (const auto& it : tests_scalar) {
FiniteElement fe;
fe.u = it[0];
@ -180,33 +180,33 @@ TEST(TestSplineFields, Grad3D)
Fields* fvector = Fields::create(sim.getPatch(1), 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,
1.25, 1.25, -0.75,
1.25, -0.75, 1.25}},
{{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, 0.0, 0.0}, {1.0, 1.0, 1.0,
1.0,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}}};
for (const auto& it : tests_vector) {
FiniteElement fe;
fe.u = it.first[0];
@ -252,15 +252,15 @@ TEST(TestSplineFields, Value3Dmx)
Fields* fvector = Fields::create(sim.getPatch(1), vc, 123);
Field* fscalar = Field::create(sim.getPatch(1), 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},
{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},
{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},
{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},
{1.0, 1.0, 1.0, 4.0, 2.0, 2.0, 3.0}};
{{{{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}},
{{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}},
{{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}},
{{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}},
{{1.0, 1.0, 1.0, 4.0, 2.0, 2.0, 3.0}}}};
for (const auto& it : tests_vector) {
FiniteElement fe;
fe.u = it[0];