Skip to content
Snippets Groups Projects
Commit 2c94b1cc authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Merge branch 'ReplaceValarray' into 'master'

Replace std::valarray with Eigen::VectorXd

See merge request ogs/ogs!5151
parents 8500da52 e34cbe28
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#pragma once #pragma once
#include <valarray>
#include <vector> #include <vector>
#include "HeatTransportBHEProcessAssemblerInterface.h" #include "HeatTransportBHEProcessAssemblerInterface.h"
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#pragma once #pragma once
#include <Eigen/Core> #include <Eigen/Core>
#include <valarray>
#include <vector> #include <vector>
#include "IntegrationPointDataMatrix.h" #include "IntegrationPointDataMatrix.h"
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <Eigen/Core>
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
#include <numeric> #include <numeric>
#include <type_traits> #include <type_traits>
#include <valarray>
#include "MeshLib/Elements/Elements.h" #include "MeshLib/Elements/Elements.h"
#include "NumLib/Fem/ShapeFunction/ShapeHex20.h" #include "NumLib/Fem/ShapeFunction/ShapeHex20.h"
...@@ -156,13 +156,13 @@ TEST(NumLib, FemShapeQuad4) ...@@ -156,13 +156,13 @@ TEST(NumLib, FemShapeQuad4)
static const double eps = std::numeric_limits<double>::epsilon(); static const double eps = std::numeric_limits<double>::epsilon();
static const unsigned NNodes = 4; static const unsigned NNodes = 4;
static const unsigned dim = 2; static const unsigned dim = 2;
std::valarray<double> r(dim); Eigen::VectorXd r(dim);
std::valarray<double> N(NNodes); Eigen::VectorXd N(NNodes);
std::valarray<double> dN(NNodes * dim); Eigen::VectorXd dN(NNodes * dim);
// check N, dN at specific location // check N, dN at specific location
{ {
r = .5; // r = (0,5, 0.5) r << 0.5, 0.5;
ShapeQuad4::computeShapeFunction(r, N); ShapeQuad4::computeShapeFunction(r, N);
ShapeQuad4::computeGradShapeFunction(r, dN); ShapeQuad4::computeGradShapeFunction(r, dN);
double exp_N[] = {0.5625, 0.1875, 0.0625, 0.1875}; double exp_N[] = {0.5625, 0.1875, 0.0625, 0.1875};
...@@ -172,13 +172,13 @@ TEST(NumLib, FemShapeQuad4) ...@@ -172,13 +172,13 @@ TEST(NumLib, FemShapeQuad4)
ASSERT_ARRAY_NEAR(exp_dN, dN, dN.size(), eps); ASSERT_ARRAY_NEAR(exp_dN, dN, dN.size(), eps);
} }
std::valarray<double> exp_N(NNodes); Eigen::VectorXd exp_N(NNodes);
// check N_i(r_j)= {i==j: 1, i!=j: 0} // check N_i(r_j)= {i==j: 1, i!=j: 0}
for (unsigned i = 0; i < NNodes; i++) for (unsigned i = 0; i < NNodes; i++)
{ {
r[0] = (i == 0 || i == 3) ? 1 : -1; r[0] = (i == 0 || i == 3) ? 1 : -1;
r[1] = i < 2 ? 1 : -1; r[1] = i < 2 ? 1 : -1;
exp_N = .0; exp_N.setZero(NNodes);
exp_N[i] = 1.0; exp_N[i] = 1.0;
ShapeQuad4::computeShapeFunction(r, N); ShapeQuad4::computeShapeFunction(r, N);
ASSERT_ARRAY_NEAR(exp_N, N, NNodes, eps); ASSERT_ARRAY_NEAR(exp_N, N, NNodes, eps);
......
...@@ -29,7 +29,3 @@ fun:_ZNKSs12find_last_ofEPKcmm ...@@ -29,7 +29,3 @@ fun:_ZNKSs12find_last_ofEPKcmm
fun:_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv fun:_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv
fun:_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_ fun:_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_
fun:_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE fun:_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE
# valarray fill loop is counting down and reaching integer subtraction overflow
# STL gcc-5.3: called from operator=(double)
fun:_ZSt15__valarray_fillIdEvPT_mRKS0_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment