Added: Alternative superelement file format

This commit is contained in:
Knut Morten Okstad 2021-04-25 09:38:42 +02:00
parent 491246b11c
commit ff9b50f033
3 changed files with 695 additions and 9 deletions

View File

@ -15,17 +15,69 @@
#include "GlobalIntegral.h"
#include "ElementBlock.h"
#include "Vec3Oper.h"
#include <numeric>
bool ASMsupel::read (std::istream& is)
{
int numNod = 0;
is >> numNod;
myNodes.resize(numNod);
// Lambda function for reading the supernode coordinates.
auto&& readCoord = [&is](Vec3Vec& Xsup)
{
int numNod = 0;
is >> numNod;
Xsup.resize(numNod);
for (Vec3& Xn : Xsup) is >> Xn;
};
myElmMat.resize(1,1);
for (Vec3& Xn : myNodes) is >> Xn;
is >> myElmMat.A.front() >> myElmMat.b.front();
return is.good();
char c;
int readMat = 0;
while (readMat < 7 && is.get(c))
switch (c) {
case 'K':
case 'k':
is >> myElmMat.A.front();
if (c == 'K') // assume stored column-wise
myElmMat.A.front().transpose();
readMat |= 1;
break;
case 'R':
is >> myElmMat.b.front();
readMat |= 2;
break;
case 'L':
{
// The load vector is stored as a ndof x 1 matrix and not a vector
Matrix tmpMat;
is >> tmpMat;
myElmMat.b.front() = tmpMat.getColumn(1);
}
readMat |= 2;
break;
case 'G':
readCoord(myNodes);
readMat |= 4;
break;
case '\n':
break;
default:
is.putback(c);
if (readMat)
{
std::cerr <<" *** ASMsupel::read: Unknown label "<< c << std::endl;
return false;
}
else
{
// Assuming the order G, K, L but without the labels
readCoord(myNodes);
is >> myElmMat.A.front() >> myElmMat.b.front();
readMat = 7;
}
}
return readMat == 7 && is.good();
}

View File

@ -16,13 +16,35 @@
#include "gtest/gtest.h"
TEST(TestASMsupel, Read)
struct TestCase
{
const char* file;
size_t nsup;
};
class TestASMsup : public testing::Test,
public testing::WithParamInterface<TestCase>
{
};
TEST_P(TestASMsup, Read)
{
ASMsupel pch;
ASMbase::resetNumbering();
std::ifstream is("src/ASM/Test/refdata/Supel.dat");
std::cout <<"Checking "<< GetParam().file << std::endl;
std::ifstream is(GetParam().file);
ASSERT_TRUE(pch.read(is));
ASSERT_FALSE(pch.empty());
ASSERT_TRUE(pch.generateFEMTopology());
EXPECT_EQ(pch.getNoNodes(),2U);
EXPECT_EQ(pch.getNoNodes(),GetParam().nsup);
}
const std::vector<TestCase> testFiles = {
{ "src/ASM/Test/refdata/Supel.dat", 2U },
{ "src/ASM/Test/refdata/kjoint.dat", 4U }};
INSTANTIATE_TEST_CASE_P(TestASMsup, TestASMsup, testing::ValuesIn(testFiles));

View File

@ -0,0 +1,612 @@
K
24
24
268427934.2602471
-5.3697279871136985
1815855.0386895584
64.90872800048002
5248600.3173385
83.10248524586964
-191640660.60348052
0.3723387179039468
3650185.8550054436
-38.77735953633158
-8039669.763324191
-12.376435499738047
-40555387.32652124
17.21812252749912
-37470224.23137092
82.09990672461396
11305811.708417699
-91.47623321081522
-36231886.32989358
-12.220719140156962
32004183.337515905
-83.24412373946184
9706280.012867825
-69.02396011034571
-5.369761897820863
6611596.570143091
2.8014648115422855
-4078983.8494915175
5.854973892950387
-47256041.16002412
-0.3722770990683394
-1780414.9453932983
0.48637793493404397
-3979423.802452605
-6.685761698998189
-24309524.624483902
2.9742920625889093
-3808554.05653847
-1.9779984342807517
-12079793.99364358
-9.856278158329703
5854487.41744329
2.767639688349595
-1022627.5705463777
-1.3089268946350125
-4017706.4892933355
1.7770828480952474
-4279404.3768664785
1815855.0387006076
2.800958485314804
11480688.19301883
-57.4414483710444
74363388.95737745
-23.116029583160003
-3650185.8550548838
0.4864000314270272
2757524.2625859384
-10.533190373202709
-792551.6094216988
4.358383428031751
-4618643.969170982
-3.5239281911696994
-8249237.04917479
34.93756494646921
-6066507.856906967
6.219417369581027
6452974.785549309
0.23701283507241447
-5988975.407466797
16.601852587645094
-745652.4755843454
8.198847875451978
64.90879716130877
-4078983.8492429135
-57.4415344402586
98646121.71119973
-236.5953215472313
14371806.182452347
38.77742317050503
-3979423.8023941033
-10.533199016300046
-75807272.365172
74.17525680708627
-24388792.964977343
-34.97086647878417
5449908.357872495
23.84533852527603
13825986.368415935
84.35707061480832
-9878959.308890766
-68.71528365658007
2608499.294579518
44.128666586305926
3627202.5460651675
26.000584138206754
6684501.247782884
5248600.317346058
5.854343199391648
74363388.95707047
-236.59533922979
654673145.1336944
-17.19418509716651
-8039669.763583445
6.685422650060408
792551.6097004379
-74.17523825919872
35451204.65787555
27.806668788232002
-28829166.85927096
-9.650377547267327
-42873195.584717005
157.00823056589442
-21908191.869338017
-1.2909350850762706
31620236.305407494
-2.887511495557964
-32282744.987580486
91.07257385457282
584615.3536752237
32.81421621886954
83.10268970336907
-47256041.16002483
-23.117003227240833
14371806.182986205
-17.19676438905207
511713850.4606587
-12.376667381335366
24309524.624149904
-4.358079547926792
24388792.965154782
27.80734600395203
165378401.34061214
-32.55739313894062
15880510.04048736
5.426776419691352
51487069.95084384
70.029392154898
-28717375.78220454
-38.1681494187147
7066006.498688378
22.04586031494712
24484913.595787205
2.319598639435134
23208264.143907502
-191640660.60350972
-0.3722395552212249
-3650185.855057474
38.777390495144616
-8039669.763557789
-12.376831463739641
268427934.2603577
5.369812796966711
-1815855.0388269685
-64.90869044822348
5248600.31779525
83.10301046376824
-36231886.32994091
12.220705512485214
-32004183.337508973
83.2441515774561
9706280.012935208
-69.02398268427967
-40555387.32644994
-17.21812437552336
37470224.231359765
-82.09986098694776
11305811.708357012
-91.47618526525108
0.3723119340378097
-1780414.9454196568
0.48647355133350945
-3979423.80239471
6.685704587461068
24309524.624481145
5.369757262246521
6611596.570360576
2.7998354662050478
-4078983.8499471843
-5.851265697900843
47256041.160322115
-2.767855872984055
-1022627.5706604307
-1.3091868700435005
-4017706.4894258897
-1.777128782485466
4279404.376928103
-2.974252116888955
-3808554.0562736904
-1.9780211820196099
-12079793.993294049
9.856294006638286
-5854487.4172549825
3650185.855003697
0.4863408348581864
2757524.26258783
-10.533246412576727
792551.6097480899
-4.357903879008554
-1815855.0388584633
2.8001120603962844
11480688.19339758
-57.44053495184603
-74363388.95921233
23.113407924792163
-6452974.785319667
0.2369925129425821
-5988975.407196181
16.60177790832976
745652.4756368164
-8.198775812300457
4618643.969173348
-3.524011360626198
-8249237.0491314195
34.93737319136553
6066507.856848693
-6.219563319066978
-38.77732920184404
-3979423.8024896695
-10.533173677619793
-75807272.3652589
-74.17514082859344
24388792.96535495
-64.90864233869809
-4078983.8499965603
-57.44036927452843
98646121.71123447
236.59421388076072
-14371806.182966528
68.7152463995216
2608499.2946984535
44.12859647650651
3627202.546173509
-26.00064806278092
-6684501.24783376
34.97067540835643
5449908.357514485
23.845607961913824
13825986.367939748
-84.35721124275092
9878959.30859293
-8039669.763365163
-6.685500271636814
-792551.6094554451
74.17558359844949
35451204.65758638
27.805969540483893
5248600.317840268
-5.851632989463276
-74363388.95895323
236.59458355765184
654673145.1409938
-17.187090179506775
31620236.304539192
2.887524272212355
32282744.98659102
-91.07243906082269
584615.3535094608
32.81408772155039
-28829166.859229304
9.650642760640286
42873195.58452387
-157.0076908076695
-21908191.869147737
-1.2904784604522241
-12.376615618456617
-24309524.62456674
4.3587846761866595
-24388792.96515363
27.808226896534496
165378401.34144473
83.10271069314621
47256041.16087352
23.113077606097693
-14371806.182482865
-17.187740156016368
511713850.46324503
-38.16891206865639
-7066006.499419005
-22.04682060599297
-24484913.596638322
2.3193992941414114
23208264.144411728
-32.557420397065506
-15880510.039167982
-5.42650423168565
-51487069.94907792
70.02922170618636
-28717375.781238373
-40555387.32649347
2.974107920054034
-4618643.969167604
-34.97082137216956
-28829166.859103
-32.55665116293657
-36231886.32991246
-2.7679775036789867
-6452974.785333002
68.71523383408594
31620236.304565758
-38.169534230971834
48707869.398374565
-14.823067884662812
40273013.16175904
-100.06128522742708
-23959535.0763017
99.68120624270537
28079404.258619882
14.616081550226241
-29201394.407372024
65.28296297987447
2947443.3547626683
60.819413897279404
17.21816350914839
-3808554.0565670375
-3.523935444343802
5449908.357796917
-9.650413366295918
15880510.040597603
12.220736305353965
-1022627.5706405627
0.23699939920920876
2608499.2946802396
2.887489943924722
-7066006.499435435
-14.82276914867364
5740836.038362928
-7.813225075678316
17732560.424440622
16.707331146942106
-12170791.364053749
-14.616126925720788
-909654.411669885
11.100172220487522
-1635059.9424858855
5.073831871429747
-2036899.5701977985
-37470224.23134685
-1.9781337339058915
-8249237.049144078
23.84530412257211
-42873195.584456824
5.427218614742025
-32004183.337506093
-1.3092664509416734
-5988975.407178692
44.12857110732675
32282744.98647676
-22.047248308331568
40273013.16191167
-7.813108907095062
43997405.279613644
-121.37908013680992
7359821.1153961085
59.92733817713355
29201394.407391082
11.100129261516486
-29759192.823604174
69.8397407006401
2038965.7345078224
57.948193108890926
82.09991944595012
-12079793.993652701
34.93761256518319
13825986.368347168
157.00835371986673
51487069.950870425
83.24415885695151
-4017706.4893806507
16.6017952365971
3627202.5462069353
-91.07256649789086
-24484913.59661726
-100.06093873992673
17732560.4244211
-121.37903864718238
67308298.84289907
-6.07110177095763
-38662690.782281995
-65.28311911518492
-1635059.9424047195
69.83988677159698
-4273985.344203588
-5.881960602134237
-4556692.368207608
11305811.708439287
-9.856273967379547
-6066507.856880205
84.35697264074113
-21908191.86927548
70.02927075966427
9706280.012937024
-1.7771150819256099
745652.4756403762
-26.00071215639201
584615.3534755447
2.319451881101658
-23959535.076095797
16.707657147150723
7359821.1154794125
-6.070880212092237
106763720.4671158
-96.82291598203558
2947443.354780311
-5.073831286168506
-2038965.734528258
5.8819560937987
-1507354.4187442602
-3.6403160687606
-91.47628421801997
5854487.41751307
6.219379157316462
-9878959.308769355
-1.2910437325903352
-28717375.782563835
-69.02401495290637
4279404.376910718
-8.198797356361908
-6684501.247815436
32.8142236667117
23208264.144517977
99.68097668041656
-12170791.364039574
59.927590785236454
-38662690.782351784
-96.82255493226648
55918584.61773742
60.81952200770493
2036899.5701109741
-57.948290602949186
4556692.368178144
-3.6403197681817523
4878151.28757138
-36231886.32990244
2.767746249919901
6452974.785556035
-68.71527163166316
31620236.305342093
-38.168737455918055
-40555387.326447815
-2.97412224209715
4618643.969196827
34.97066314993007
-28829166.859305423
-32.55690248447958
28079404.25862094
-14.616112468257567
29201394.40740103
-65.28304179690731
2947443.3547896054
60.81948751661875
48707869.39767854
14.822852739007963
-40273013.16126815
100.06109924854367
-23959535.076172724
99.68109870957316
-12.220728576038447
-1022627.5705398797
0.23702733929019254
2608499.2945537195
-2.8874514925229375
7066006.4987933375
-17.21815565761596
-3808554.056275794
-3.52401067904318
5449908.3574727345
9.650584782378017
-15880510.039339107
14.616121819502352
-909654.4116662699
11.100151182683982
-1635059.9424123769
-5.073846720360661
2036899.570097982
14.822666598047157
5740836.039537704
-7.812894423257035
17732560.425985947
-16.70753153660285
12170791.365223331
32004183.337528214
-1.3090284963466083
-5988975.407456464
44.128647074439996
-32282744.987422824
22.046452609969933
37470224.231358044
-1.9781514624216496
-8249237.04915803
23.845592541649612
42873195.58460821
-5.427069934465563
-29201394.407353584
11.100157121914798
-29759192.823591907
69.8398135330285
-2038965.7345322594
-57.94825432933704
-40273013.16111144
-7.8128991920280235
43997405.27960507
-121.3788624148321
-7359821.115805296
-59.92735632433569
-83.24415125164208
-4017706.489310969
16.601911993063947
3627202.5460224985
91.07278988732241
24484913.595987935
-82.09990555368547
-12079793.993228514
34.937371201235855
13825986.367908806
-157.00780029740375
-51487069.949130625
65.28306519656701
-1635059.942494623
69.83979852990069
-4273985.344223258
5.881928758357971
4556692.36816279
100.06089613691354
17732560.4260003
-121.37873002838754
67308298.84453072
6.070971284174604
38662690.7836723
9706280.012863657
1.7770636701705893
-745652.4755718628
26.00064949502014
584615.3537099898
2.3196651019379377
11305811.708358891
9.856259650462205
6066507.856865749
-84.35710751732782
-21908191.869254395
70.02912342087396
2947443.3547910885
5.073829626872097
2038965.7345336454
-5.881974619359586
-1507354.418745536
-3.6403054328763735
-23959535.07637914
-16.70757352951737
-7359821.115603572
6.070915230248793
106763720.46725023
-96.82284500553955
-69.02400828835985
-4279404.376897848
8.198906286412624
6684501.247745207
32.814428095976425
23208264.14423147
-91.4762632766432
-5854487.417275809
-6.219542268342911
9878959.30859743
-1.2906749014169314
-28717375.78158712
60.81951162523875
-2036899.5701956688
57.94825989002692
-4556692.368235078
-3.640332411691472
4878151.287555863
99.68098181660002
12170791.365048354
-59.927288542613866
38662690.78345837
-96.82280375727936
55918584.61878134
L
24
1
-0.0045434910689639745
-127.69056667140352
0.004343158007611724
808.5595755594522
0.01464675829809371
-4080.85285374016
0.004544920270311843
-127.69056612643833
0.00433949691070525
808.5595740048611
-0.014637048260105468
4080.852856278673
-0.0038734253803743217
127.69056276774441
-0.004343794372893446
-170.10675142264708
-0.0007217071412891985
-455.6745341373951
0.0038717229046902096
127.69056682802214
-0.004342321407551691
-170.10674653444013
0.0007210797502183291
455.6745369369561
G
4
10.0 0.0 0.0
-10.0 0.0 0.0
5.0 0.0 5.0
-5.0 0.0 5.0