Commit 29e9077f authored by incardon's avatar incardon
Browse files

Fixing Tensor rank 2

parent 1cd82555
Pipeline #3070 failed with stages
in 29 minutes and 10 seconds
......@@ -585,8 +585,9 @@ struct meta_prop<I, ele_g,St,T[N1],is_writable>
if (ft == file_type::ASCII)
{
// Print the properties
for (size_t i1 = 0 ; i1 < N1 ; i1++)
{stream_out << vg.get(k).g.template get<I::value>(it.get())[i1] << " ";}
stream_out << vg.get(k).g.template get<I::value>(it.get())[0];
for (size_t i1 = 1 ; i1 < N1 ; i1++)
{stream_out << " " << vg.get(k).g.template get<I::value>(it.get())[i1];}
if (N1 == 2)
{stream_out << (decltype(vg.get(k).g.template get<I::value>(it.get())[0])) 0;}
......@@ -846,8 +847,9 @@ struct meta_prop_new<I, ele_g,St,T[N1],is_writable>
if (ft == file_type::ASCII)
{
// Print the properties
for (size_t i1 = 0 ; i1 < N1 ; i1++)
{v_outToEncode_ << vg.get(k).g.template get<I::value>(it.get())[i1] << " ";}
v_outToEncode_ << vg.get(k).g.template get<I::value>(it.get())[0];
for (size_t i1 = 1 ; i1 < N1 ; i1++)
{v_outToEncode_ << " " << vg.get(k).g.template get<I::value>(it.get())[i1];}
if (N1 == 2)
{v_outToEncode_ << (decltype(vg.get(k).g.template get<I::value>(it.get())[0])) 0;}
......@@ -980,10 +982,15 @@ struct meta_prop_new<I, ele_g,St, T[N1][N2],is_writable>
}
}
static inline void get_pvtp_out(std::string & v_out, const openfpm::vector<std::string> & prop_names){
v_out += get_point_property_header_impl_new_pvtp<I::value,ele_g,has_attributes<typename ele_g::value_type::value_type>::value>("",prop_names);
static inline void get_pvtp_out(std::string & v_out, const openfpm::vector<std::string> & prop_names)
{
for (size_t i1 = 0 ; i1 < N1 ; i1++)
{
for (size_t i2 = 0 ; i2 < N2 ; i2++)
{
v_out += get_point_property_header_impl_new_pvtp<I::value,ele_g,has_attributes<typename ele_g::value_type::value_type>::value>("_" + std::to_string(i1) + "_" + std::to_string(i2),prop_names);
}
}
}
};
......@@ -1045,11 +1052,13 @@ template<unsigned int dims,typename T> inline void output_point_new(Point<dims,T
{
if (ft == file_type::ASCII)
{
v_out << p.toString();
size_t i = dims;
for ( ; i < 3 ; i++)
{v_out << " 0.0";}
v_out << "\n";
v_out << p[0];
for (int i = 1 ; i < dims ; i++)
{v_out << " " << p[i];}
size_t i = dims;
for ( ; i < 3 ; i++)
{v_out << " 0.0";}
v_out << "\n";
}
else
{
......
......@@ -346,18 +346,41 @@ class VTKWriter<pair,VECTOR_POINTS>
//! vertex node output string
std::stringstream v_out;
v_out<<" <Points>\n";
v_out<<" <Points>\n";
if (opt == file_type::ASCII)
if (std::is_same<float,typename pair::first::value_type::coord_type>::value == true)
{
v_out<<" <DataArray type=\"Float64\" Name=\"Points\" NumberOfComponents=\"3\" format=\"ascii\">\n";
if (opt == file_type::ASCII)
{
v_out<<" <DataArray type=\"Float32\" Name=\"Points\" NumberOfComponents=\"3\" format=\"ascii\">\n";
}
else
{
v_out<<" <DataArray type=\"Float32\" Name=\"Points\" NumberOfComponents=\"3\" format=\"binary\">\n";
}
}
else
{
v_out<<" <DataArray type=\"Float64\" Name=\"Points\" NumberOfComponents=\"3\" format=\"binary\">\n";
if (opt == file_type::ASCII)
{
v_out<<" <DataArray type=\"Float64\" Name=\"Points\" NumberOfComponents=\"3\" format=\"ascii\">\n";
}
else
{
v_out<<" <DataArray type=\"Float64\" Name=\"Points\" NumberOfComponents=\"3\" format=\"binary\">\n";
}
}
std::stringstream binaryToEncode;
if (std::is_same<float,typename pair::first::value_type::coord_type>::value == true)
{
binaryToEncode << std::setprecision(7);
}
else
{
binaryToEncode << std::setprecision(16);
}
//! For each defined grid
if (opt == file_type::BINARY)
{
......
......@@ -1024,7 +1024,7 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set )
vtk_v.write("vtk_points.vtp",prp_names);
//auto &v_cl=create_vcluster();
//size_t n=v_cl.size();
vtk_v.write_pvtp("vtk_points.pvtp",prp_names,2);
vtk_v.write_pvtp("vtk_points",prp_names,2);
#ifndef SE_CLASS3
......
......@@ -6,9 +6,9 @@
<PDataArray type="Float32" Name="domain"/>
</PPointData>
<PPoints>
<PDataArray type=Float64 Name="Points" NumberOfComponents="3"/>
<PDataArray type="Float64" Name="Points" NumberOfComponents="3"/>
</PPoints>
<Piece Source="vtk_points.pvtp_0.vtp"/>
<Piece Source="vtk_points.pvtp_1.vtp"/>
<Piece Source="vtk_points_0.vtp"/>
<Piece Source="vtk_points_1.vtp"/>
</PPolyData>
</VTKFile>
\ No newline at end of file
This diff is collapsed.
......@@ -398,70 +398,70 @@ LOOKUP_TABLE default
1
1
VECTORS attr4 double
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11
12 12 12
13 13 13
14 14 14
15 15 15
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11
12 12 12
13 13 13
14 14 14
15 15 15
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11
12 12 12
13 13 13
14 14 14
15 15 15
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11
12 12 12
13 13 13
14 14 14
15 15 15
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11
12 12 12
13 13 13
14 14 14
15 15 15
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11
12 12 12
13 13 13
14 14 14
15 15 15
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11
12 12 12
13 13 13
14 14 14
15 15 15
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11
12 12 12
13 13 13
14 14 14
15 15 15
SCALARS attr5_0_0 double
LOOKUP_TABLE default
0
......
......@@ -8,106 +8,106 @@
<Piece NumberOfPoints="100" NumberOfVerts="100">
<Points>
<DataArray type="Float64" Name="Points" NumberOfComponents="3" format="ascii">
0.191120 0.542772 0.939108
0.933523 0.710147 0.682257
0.228446 0.513097 0.438905
0.700754 0.436179 0.434735
0.751419 0.522504 0.196855
0.666369 0.261523 0.050127
0.573708 0.768383 0.022587
0.750211 0.313137 0.190846
0.507718 0.273360 0.264172
0.670213 0.932599 0.212948
0.586036 0.006718 0.574775
0.336361 0.205412 0.440432
0.553825 0.740555 0.064820
0.764503 0.468990 0.878126
0.323438 0.181610 0.943831
0.329992 0.043079 0.688576
0.095793 0.009830 0.801123
0.349360 0.212307 0.266992
0.368002 0.414173 0.890974
0.471037 0.198481 0.584590
0.363141 0.971788 0.567570
0.193627 0.047362 0.347666
0.078823 0.824102 0.303324
0.892978 0.147594 0.589520
0.768770 0.021556 0.879563
0.173734 0.131239 0.179741
0.392798 0.563805 0.325374
0.241990 0.120892 0.993650
0.950192 0.297734 0.372967
0.618250 0.020735 0.852418
0.507541 0.634685 0.435244
0.857826 0.812930 0.263612
0.905927 0.426169 0.242918
0.551551 0.826687 0.394286
0.107476 0.018033 0.122876
0.027658 0.315680 0.861391
0.864926 0.042390 0.667640
0.937087 0.686836 0.209923
0.960032 0.214003 0.456393
0.838234 0.705078 0.379994
0.743514 0.670946 0.671558
0.434425 0.879627 0.032296
0.954834 0.877288 0.061284
0.239914 0.979709 0.690876
0.334337 0.292961 0.194138
0.397971 0.064623 0.159310
0.639743 0.559217 0.628284
0.319393 0.698422 0.808751
0.534981 0.605794 0.215716
0.932453 0.633508 0.954549
0.860046 0.170877 0.901505
0.581338 0.696935 0.013719
0.273513 0.037100 0.801600
0.857205 0.467507 0.627542
0.752721 0.974119 0.427029
0.371101 0.245019 0.119228
0.733240 0.911167 0.240259
0.659184 0.906727 0.920069
0.723200 0.826380 0.620956
0.665010 0.286470 0.644219
0.550957 0.831365 0.249487
0.136109 0.843937 0.995786
0.958540 0.434625 0.812213
0.025767 0.297417 0.212592
0.956965 0.060432 0.382506
0.647490 0.425935 0.083679
0.492244 0.694858 0.917290
0.595547 0.101746 0.165874
0.715210 0.552892 0.556047
0.727179 0.190203 0.479701
0.452899 0.191989 0.800239
0.189775 0.575804 0.255534
0.787141 0.426864 0.467209
0.674216 0.630124 0.240190
0.921028 0.344758 0.550895
0.051571 0.205424 0.679874
0.450943 0.397533 0.256193
0.520349 0.229449 0.854270
0.444768 0.451041 0.509270
0.033064 0.374076 0.800554
0.524198 0.393980 0.552048
0.743037 0.632495 0.584216
0.264430 0.570424 0.532054
0.538226 0.023322 0.450331
0.513191 0.768138 0.952403
0.790408 0.301653 0.043437
0.328417 0.622360 0.766373
0.186272 0.564519 0.339561
0.251027 0.787802 0.694365
0.045131 0.074015 0.734981
0.066324 0.363983 0.337433
0.129496 0.763412 0.395678
0.451936 0.568539 0.719855
0.084249 0.651408 0.904191
0.484451 0.939076 0.217938
0.355350 0.994250 0.900963
0.195476 0.033896 0.116821
0.772962 0.692030 0.614234
0.727780 0.125820 0.608612
0.602774 0.518449 0.155444
0.1911204835906995 0.542772234863242 0.9391084311347881
0.9335227608990284 0.7101470601232037 0.6822569448583494
0.2284457291343968 0.5130972196287023 0.4389047685829435
0.7007540749848102 0.4361787988170149 0.434735135904171
0.7514191254733973 0.5225035562075192 0.1968549575205636
0.6663689566001441 0.2615225984428438 0.05012694930186171
0.5737078582990413 0.7683834686091247 0.02258709072014918
0.7502107521285253 0.3131366773447317 0.19084589686671
0.5077175316364888 0.273360300449021 0.2641722528430763
0.6702125993695983 0.9325986239441677 0.2129484658534879
0.5860363067658449 0.006718086774126586 0.5747754901765029
0.3363611228594737 0.2054122738980631 0.440431623980202
0.5538249255373027 0.7405553773322351 0.06481964953019299
0.7645033599042783 0.4689904130208351 0.8781258748480464
0.3234378533328707 0.1816097199071153 0.9438311790843349
0.3299919011397325 0.04307922253241799 0.6885764593311695
0.09579277662756258 0.009829631769177675 0.8011234804051354
0.349360455596186 0.2123068029934974 0.2669917034138964
0.3680017998591057 0.4141731548988385 0.8909741738387503
0.4710369047378018 0.1984811508103827 0.58458962613503
0.3631405123215446 0.9717880950906369 0.5675700369442022
0.1936272575083993 0.04736226888030662 0.3476663842575315
0.07882256103734367 0.8241018204371902 0.303324121142121
0.8929782123803263 0.1475944068992537 0.5895199090756849
0.7687700724840304 0.02155637553820555 0.8795632899834014
0.1737343588966251 0.1312391759682264 0.17974067401153
0.3927977460470061 0.5638048846443161 0.3253738999714265
0.2419903749870181 0.1208916897322556 0.9936496475741036
0.9501923853763414 0.2977338999986025 0.3729671694464203
0.6182502835904014 0.02073462096940045 0.8524181016942401
0.5075412101542851 0.6346851323569729 0.43524397656543
0.8578262048038532 0.812929702544152 0.2636116872245391
0.9059269298306075 0.4261686958250736 0.2429180805371524
0.5515512116013322 0.8266865900593406 0.3942855250116971
0.1074755519593714 0.01803298945630296 0.1228763367408531
0.02765798311323953 0.3156797104442121 0.861391111108758
0.8649262157897809 0.04239008713402315 0.6676403360126352
0.9370865563689328 0.6868358011418787 0.2099227371113735
0.960032065883264 0.2140025856373819 0.456392921993326
0.8382337566752761 0.7050784166412994 0.3799939060676871
0.7435136531742692 0.6709460550123145 0.6715583376718879
0.4344248930297676 0.8796267049016306 0.03229555323147422
0.954833504997737 0.8772878603184187 0.06128421306550307
0.2399140958488387 0.9797094480694694 0.6908761986108142
0.3343371959243262 0.2929608892682191 0.1941379300811617
0.397970957496217 0.06462349669792526 0.1593095428965476
0.6397433510796431 0.5592166427247148 0.6282844533546434
0.3193929764351841 0.6984220029793577 0.80875064534659
0.5349810723983771 0.6057937172680191 0.2157163788956979
0.9324525741709151 0.6335081746180038 0.9545486953786814
0.8600456622149583 0.1708769709007456 0.9015052784692937
0.5813384917185929 0.6969345811768739 0.01371900876345159
0.273512542120408 0.03710026944191182 0.8015997992821039
0.8572047884309643 0.4675072033575237 0.6275424309412285
0.752720738410614 0.9741190960751291 0.4270292877093753
0.3711011035502417 0.2450185705698009 0.1192280246786643
0.7332403106925821 0.911166650750131 0.2402591692561939
0.6591842769835218 0.9067273070538755 0.9200686265621014
0.7232003117803483 0.8263801707297656 0.6209564266628789
0.6650097755878187 0.2864695779110912 0.6442191851585083
0.5509565770388783 0.8313646028603592 0.2494865675692043
0.1361090191006153 0.8439365332741586 0.9957855816484497
0.9585403138964715 0.434624640534341 0.8122126430681847
0.02576744741491627 0.2974174612679438 0.212592003302373
0.9569645649953911 0.06043218399377904 0.3825060332275433
0.6474896468466662 0.4259350465489854 0.08367909021504266
0.4922437558452395 0.6948581858562035 0.9172901085497391
0.5955465333091344 0.1017459290559655 0.165873761677242
0.7152102458219928 0.5528916897937228 0.5560473017133553
0.7271787548776815 0.1902025601872231 0.4797005588283294
0.4528986639562535 0.1919889090620033 0.8002391630782564
0.1897753117653656 0.5758043692559914 0.2555337107016082
0.7871409951303429 0.4268640671265945 0.467209433220695
0.6742162717626354 0.6301241437298599 0.2401900376471737
0.9210282743810544 0.3447579399939822 0.5508949667909672
0.05157142968309511 0.2054241342910453 0.6798739928380242
0.4509434115835729 0.3975326198164688 0.2561928176990744
0.5203486320002244 0.2294494166367457 0.8542700815693149
0.4447680844716876 0.4510409422446783 0.5092696894382733
0.03306415512549497 0.3740759378419836 0.8005538842172577
0.5241983793563217 0.3939801634317356 0.5520479010641351
0.7430373780694616 0.6324951552634616 0.5842160128130502
0.2644295004362103 0.5704235038392136 0.5320537506919104
0.5382255930275537 0.02332186558129179 0.4503306467317368
0.5131908124251334 0.768137676982145 0.9524025549402448
0.7904084488794169 0.3016534904941667 0.04343723573561886
0.3284171929916287 0.6223598420050183 0.7663728286203123
0.1862722212978302 0.5645188321059016 0.3395605285933425
0.2510267294705721 0.7878024916687038 0.6943653734892768
0.04513135247624882 0.0740146524859524 0.7349814112600958
0.06632412990260676 0.3639832542445589 0.3374328332313183
0.1294963133384025 0.7634123220278825 0.3956784722881026
0.4519362433571665 0.5685394247674666 0.7198549109884282
0.08424916137743314 0.6514083344249947 0.9041910993847107
0.4844505633299935 0.9390759491645377 0.2179379692683285
0.3553499535865384 0.9942502239745807 0.9009634640994651
0.1954761365449633 0.03389617077359176 0.1168213434904714
0.7729623207017023 0.6920302497725793 0.6142337803662598
0.7277798272074294 0.1258201226006168 0.6086119675968718
0.602774259586458 0.5184492738831559 0.1554437490853277
</DataArray>
</Points>
<Verts>
......@@ -318,208 +318,208 @@
</Verts>
<PointData>
<DataArray type="Float32" Name="attr0" format="ascii">
0.949426
0.277201
0.376442
0.502502
0.661436
0.805367
0.342563
0.811196
0.865707
0.528286
0.214237
0.222135
0.680595
0.9494255
0.2772013
0.3764421
0.5025018
0.6614359
0.8053668
0.3425626
0.8111961
0.8657068
0.5282862
0.2142366
0.2221354
0.6805948
0.877432
0.498441
0.960167
0.530659
0.365743
0.515093
0.804031
0.680893
0.127910
0.717390
0.977225
0.272178
0.926172
0.4984407
0.9601666
0.5306594
0.3657426
0.5150926
0.8040309
0.6808926
0.1279096
0.7173896
0.9772254
0.2721777
0.9261724
0.580568
0.321983
0.497249
0.938873
0.833009
0.779967
0.3219828
0.4972493
0.9388732
0.8330092
0.7799672
0.725488
0.199308
0.090781
0.817653
0.191807
0.906924
0.864567
0.695952
0.682480
0.979791
0.491532
0.09078119
0.8176525
0.1918074
0.9069242
0.8645669
0.6959521
0.68248
0.9797909
0.4915317
0.533063
0.083141
0.247945
0.335915
0.026614
0.983773
0.08314063
0.2479446
0.3359151
0.02661425
0.9837726
0.523158
0.739292
0.914939
0.454955
0.820094
0.286058
0.676279
0.070532
0.776539
0.591060
0.998482
0.735711
0.560975
0.015887
0.7392922
0.9149389
0.4549547
0.8200942
0.2860577
0.6762785
0.07053214
0.7765388
0.5910597
0.9984819
0.7357114
0.5609745
0.01588653
0.152219
0.998366
0.840241
0.050251
0.069199
0.564634
0.496885
0.432840
0.867086
0.502347
0.079045
0.9983656
0.8402412
0.05025113