]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
MEDLoader.WriteFieldUsingAlreadyWrittenMesh works with mesh not unstructured.
authorageay <ageay>
Wed, 15 Jan 2014 15:46:38 +0000 (15:46 +0000)
committerageay <ageay>
Wed, 15 Jan 2014 15:46:38 +0000 (15:46 +0000)
src/MEDLoader/MEDLoader.cxx

index 75c9acc1a3a38f31d6012e8b00fe798c4625d402..802903ef22e6d3bafc076ded6fa87baae86fa42c 100644 (file)
@@ -1597,12 +1597,15 @@ void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const Pa
     }
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts(MEDFileField1TS::New());
   AssignStaticWritePropertiesTo(*f1ts);
-  MEDCouplingUMesh *m=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh()));
-  if(!m)
-    throw INTERP_KERNEL::Exception("MEDLoader::WriteFieldUsingAlreadyWrittenMesh : only umesh in input field supported !");
-  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=m->getRenumArrForMEDFileFrmt();
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
-  f2->renumberCells(o2n->begin(),false);
-  f1ts->setFieldNoProfileSBT(f2);
+  MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh())));
+  if(m)
+    {
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+      MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
+      f2->renumberCells(o2n->begin(),false);
+      f1ts->setFieldNoProfileSBT(f2);
+    }
+  else
+    f1ts->setFieldNoProfileSBT(f);
   f1ts->write(fileName,0);
 }