MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
}
MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MED_CARTESIAN,comp,unit));
- MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
+ if(_univ_wr_status)
+ MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDFileUMeshL2::WriteCoords(fid,meshName,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords);
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : internal problem !");
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newFam=DataArrayInt::New();
newFam->alloc(newm1->getNumberOfCells(),1);
- int idd=getMaxFamilyId()+1;
+ // Get a new family ID: care must be taken if we need a positive ID or a negative one:
+ // Positive ID for family of nodes, negative for all the rest.
+ int idd;
+ if (m1->getMeshDimension() == 0)
+ idd=getMaxFamilyId()+1;
+ else
+ idd=getMinFamilyId()-1;
int globStart=0,start=0,end,globEnd;
int nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples();
for(int i=0;i<nbOfChunks;i++)
return ret;
}
+/*! \cond HIDDEN_ITEMS */
struct MEDLoaderAccVisit1
{
MEDLoaderAccVisit1():_new_nb_of_nodes(0) { }
int operator()(bool val) { return val?_new_nb_of_nodes++:-1; }
int _new_nb_of_nodes;
};
+/*! \endcond */
/*!
* Array returned is the correspondance in \b old \b to \b new format. The returned array is newly created and should be dealt by the caller.
continue;
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1Tmp(getMeshAtLevel(*lev));
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1(dynamic_cast<MEDCouplingUMesh *>(m1Tmp->deepCpy()));
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> notUsed(m1->convertLinearCellsToQuadratic(conversionType));
- }
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> m1Coords(m1->getCoords()->selectByTupleId2(initialNbNodes,m1->getNumberOfNodes(),1));
- DataArrayInt *b(0);
- bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bSafe(b);
- if(!a)
+ if(m1->getMeshDimension()!=0)
{
- std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << *lev << " problem to identify nodes generated !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> notUsed(m1->convertLinearCellsToQuadratic(conversionType));
+ }//kill unused notUsed var
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> m1Coords(m1->getCoords()->selectByTupleId2(initialNbNodes,m1->getNumberOfNodes(),1));
+ DataArrayInt *b(0);
+ bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b));
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bSafe(b);
+ if(!a)
+ {
+ std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << *lev << " problem to identify nodes generated !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ b->applyLin(1,initialNbNodes);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota();
+ std::vector<const DataArrayInt *> v(2); v[0]=l0; v[1]=b;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renum(DataArrayInt::Aggregate(v));
+ m1->renumberNodesInConn(renum->begin());
}
- b->applyLin(1,initialNbNodes);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota();
- std::vector<const DataArrayInt *> v(2); v[0]=l0; v[1]=b;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renum(DataArrayInt::Aggregate(v));
- m1->renumberNodesInConn(renum->begin());
m1->setCoords(zeCoords);
ret->setMeshAtLevel(*lev,m1);
famField=getFamilyFieldAtLevel(*lev);
MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
}
MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,spaceDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MED_CARTESIAN,comp,unit));
- MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
+ if(_univ_wr_status)
+ MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MED_CARTESIAN_GRID));
for(int i=0;i<spaceDim;i++)
{
MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
}
MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,meshDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MED_CARTESIAN,comp,unit));
- MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
+ if(_univ_wr_status)
+ MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MED_CURVILINEAR_GRID));
std::vector<int> nodeGridSt=_clmesh->getNodeGridStructure();
MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,&nodeGridSt[0]));