diff --git a/Common/ListUtils.cpp b/Common/ListUtils.cpp index dbfb01819fede6dbe134e225c6b1017319b8c5b0..49b519247fb818dd7c31300f1b32569dfd3936c7 100644 --- a/Common/ListUtils.cpp +++ b/Common/ListUtils.cpp @@ -115,8 +115,10 @@ int List_Nbr(List_T * liste) void List_Read(List_T * liste, int index, void *data) { - if((index < 0) || (index >= liste->n)) - Msg::Fatal("Wrong list index (read)"); + if((index < 0) || (index >= liste->n)){ + Msg::Error("Wrong list index (read)"); + index = 0; + } memcpy(data, &liste->array[index * liste->size], liste->size); } @@ -138,18 +140,20 @@ void List_Pop(List_T * liste) void *List_Pointer(List_T * liste, int index) { - if((index < 0) || (index >= liste->n)) - Msg::Fatal("Wrong list index (pointer)"); - + if((index < 0) || (index >= liste->n)){ + Msg::Error("Wrong list index (pointer)"); + index = 0; + } liste->isorder = 0; return (&liste->array[index * liste->size]); } void *List_Pointer_NoChange(List_T * liste, int index) { - if((index < 0) || (index >= liste->n)) - Msg::Fatal("Wrong list index (pointer)"); - + if((index < 0) || (index >= liste->n)){ + Msg::Error("Wrong list index (pointer)"); + index = 0; + } return (&liste->array[index * liste->size]); } @@ -273,7 +277,7 @@ void List_Copy(List_T * a, List_T * b) void List_Remove(List_T *a, int i) { - memcpy(&a->array[i * a->size], &a->array[(i + 1) * a->size], + memcpy(&a->array[i * a->size], &a->array[(i + 1) * a->size], a->size * (a->n - i - 1)); a->n--; } @@ -293,7 +297,7 @@ void List_Insert_In_List(List_T *a, int i, List_T *b) List_T *ListOfDouble2ListOfInt(List_T *dList) { - int n = List_Nbr(dList); + int n = List_Nbr(dList); List_T *iList = List_Create(n, n, sizeof(int)); for(int i = 0; i < n; i++){ double d; diff --git a/Geo/GEntity.cpp b/Geo/GEntity.cpp index 17692832026e4519278ee973d4ee80a96ff75db7..6f83809b10318dc3c61fce11db040935732666d2 100644 --- a/Geo/GEntity.cpp +++ b/Geo/GEntity.cpp @@ -70,12 +70,10 @@ GFace *GEntity::cast2Face() { return dynamic_cast<GFace*>(this); } GRegion *GEntity::cast2Region() { return dynamic_cast<GRegion*>(this); } // sets the entity m from which the mesh will be copied -void GEntity::setMeshMaster(int m_signed){ - +void GEntity::setMeshMaster(int m_signed) +{ if(m_signed == tag()){ _meshMaster = m_signed; return; } - // printf("setting mesh master %d to mesh entity %d\n",m_signed,tag()); - GEntity *gMaster = 0; int m = abs(m_signed); switch(dim()){ @@ -85,7 +83,9 @@ void GEntity::setMeshMaster(int m_signed){ case 3 : gMaster = model()->getRegionByTag(m); break; } if (!gMaster){ - Msg::Fatal("Model entity %d of dimension %d cannot be the mesh master of model entity %d",m,dim(), tag()); + Msg::Error("Model entity %d of dimension %d cannot be the mesh master of entity %d", + m, dim(), tag()); + return; } int masterOfMaster = gMaster->meshMaster(); @@ -93,14 +93,13 @@ void GEntity::setMeshMaster(int m_signed){ _meshMaster = m_signed; } else { - // printf("mesh entity %d has already a master %d\n",m,masterOfMaster); setMeshMaster ( masterOfMaster * ((m_signed > 0) ? 1 : -1)); } } // gets the entity from which the mesh will be copied -int GEntity::meshMaster() const{ - +int GEntity::meshMaster() const +{ if (_meshMaster == tag()) return tag(); GEntity *gMaster = 0; @@ -111,7 +110,8 @@ int GEntity::meshMaster() const{ case 3 : gMaster = model()->getRegionByTag(abs(_meshMaster)); break; } if (!gMaster){ - Msg::Fatal("meshMaster : Model entity %d of dimension %d cannot be the mesh master of model entity %d",_meshMaster,dim(),tag()); + Msg::Error("Could not find mesh master entity %d",_meshMaster); + return tag(); } int masterOfMaster = gMaster->meshMaster(); @@ -122,4 +122,3 @@ int GEntity::meshMaster() const{ return gMaster->meshMaster() * ((_meshMaster > 0) ? 1 : -1); } } - diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index d6c4b63659a756c858eff5d4c55eba0bec916786..90afa63f3acc54f72daa2a93bddcf3374040b0eb 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -2808,7 +2808,8 @@ static void glueFacesInRegions(GModel *model, for (std::list<GFace*>::iterator fit = old.begin(); fit != old.end(); fit++){ std::map<GFace*, GFace*>::iterator itR = Duplicates2Unique.find(*fit); if (itR == Duplicates2Unique.end()){ - Msg::Fatal("Error in the gluing process"); + Msg::Error("Error in the gluing process"); + return; } GFace *temp = itR->second;; fnew.push_back(temp); diff --git a/Geo/OCCEdge.cpp b/Geo/OCCEdge.cpp index 6f57503fd2f6665dafc805733390259cad6c4038..08794ede6ad59254312a3353c0cc96d93d494fd7 100644 --- a/Geo/OCCEdge.cpp +++ b/Geo/OCCEdge.cpp @@ -76,8 +76,11 @@ SPoint2 OCCEdge::reparamOnFace(const GFace *face, double epar, int dir) const } if(c2d.IsNull()){ - Msg::Fatal("Reparam on face failed: curve %d is not on surface %d", + Msg::Error("Reparam on face failed: curve %d is not on surface %d", tag(), face->tag()); + const GPoint pt = point(epar); + SPoint3 sp(pt.x(), pt.y(), pt.z()); + return face->parFromPoint(sp); } double u, v;