vtkCellArray *cc(ds->GetLines());
if(cc)
{
- MCAuto<MEDCouplingUMesh> subMesh(BuildMeshFromCellArray(cc,coords,1,INTERP_KERNEL::NORM_SEG2));
+ MCAuto<MEDCouplingUMesh> subMesh;
+ try
+ {
+ subMesh=BuildMeshFromCellArray(cc,coords,1,INTERP_KERNEL::NORM_SEG2);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ std::ostringstream oss; oss << "MEDWriter does not manage polyline cell type because MED file format does not support it ! Maybe it is the source of the problem ? The cause of this exception was " << e.what() << std::endl;
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
if((const MEDCouplingUMesh *)subMesh)
{
std::vector<MCAuto<DataArray> > cellFs(AddPartFields2(offset,offset+subMesh->getNumberOfCells(),ds->GetCellData()));
return 1;
}
+template<class T>
+void ExceptionDisplayer(vtkMEDWriter *self, const std::string& fileName, T& e)
+{
+ std::ostringstream oss;
+ oss << "Exception has been thrown in vtkMEDWriter::RequestData : During writing of \"" << fileName << "\", the following exception has been thrown : "<< e.what() << std::endl;
+ if(self->HasObserver("ErrorEvent") )
+ self->InvokeEvent("ErrorEvent",const_cast<char *>(oss.str().c_str()));
+ else
+ vtkOutputWindowDisplayErrorText(const_cast<char *>(oss.str().c_str()));
+ vtkObject::BreakOnError();
+}
+
int vtkMEDWriter::RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
{
//std::cerr << "########################################## vtkMEDWriter::RequestData ########################################## " << (const char *) this->FileName << std::endl;
}
}
}
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ ExceptionDisplayer(this,(const char *) this->FileName,e);
+ return 0;
+ }
catch(MZCException& e)
{
- std::ostringstream oss;
- oss << "Exception has been thrown in vtkMEDWriter::RequestData : During writing of \"" << (const char *) this->FileName << "\", the following exception has been thrown : "<< e.what() << std::endl;
- if(this->HasObserver("ErrorEvent") )
- this->InvokeEvent("ErrorEvent",const_cast<char *>(oss.str().c_str()));
- else
- vtkOutputWindowDisplayErrorText(const_cast<char *>(oss.str().c_str()));
- vtkObject::BreakOnError();
+ ExceptionDisplayer(this,(const char *) this->FileName,e);
return 0;
}
return 1;