+void SauvLoaderTest::testSauv2MedOnA3SubsField()
+{
+ // read SAUV
+ std::string sauvFile = getResourceFile("portico_3subs.sauv");
+ MEDCouplingAutoRefCountObjectPtr<SauvReader> sr=SauvReader::New(sauvFile.c_str());
+ MEDCouplingAutoRefCountObjectPtr<MEDFileData> d2=sr->loadInMEDFileDS();
+ // check mesh
+ MEDFileUMesh* m2 = static_cast<MEDFileUMesh*>(d2->getMeshes()->getMeshAtPos(0));
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh1d = m2->getMeshAtLevel(0);
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> length1dField = mesh1d->getMeasureField(0);
+ std::cout << "Length of 1d elements: " << length1dField->accumulate(0) << std::endl;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3, length1dField->accumulate(0), 1e-12);
+ // check field
+ MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> field =
+ dynamic_cast<MEDFileFieldMultiTS *>(d2->getFields()->getFieldWithName("CHAM1D"));
+ std::cout << "Number of components in field: " << field->getInfo().size() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(6,(int)field->getInfo().size());
+ std::vector< std::pair<int,int> > timesteps = field->getIterations();
+
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field1d =
+ field->getFieldOnMeshAtLevel(ON_GAUSS_NE, timesteps[0].first, timesteps[0].second, 0, m2);
+
+ // Check first component of the field
+ // 2 gauss points per element => 12 values
+ double values[12] = {
+ -7.687500000000e-03,
+ -7.687500000000e-03,
+ -4.562500000000e-03,
+ -4.562500000000e-03,
+ -8.208333333333e-03,
+ -8.208333333333e-03,
+ -6.125000000000e-03,
+ -6.125000000000e-03,
+ -4.041666666666e-03,
+ -4.041666666666e-03,
+ -6.111413346910e-07,
+ -6.111413346910e-07};
+
+ for (int i=0; i < field1d->getNumberOfTuples(); i++)
+ {
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( values[i], field1d->getIJ(i, 0), 1e-12 );
+ }