Skip to content
Snippets Groups Projects
Commit 1465069e authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

- complain if gunzip failed

- better tol in checkMeshCoherence()
parent 93fd9252
No related branches found
No related tags found
No related merge requests found
// $Id: OS.cpp,v 1.7 2007-03-19 21:48:13 geuzaine Exp $
// $Id: OS.cpp,v 1.8 2007-05-23 15:35:33 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -160,7 +160,7 @@ int KillProcess(int pid)
return 1;
}
void SystemCall(char *command)
int SystemCall(char *command)
{
#if defined(WIN32)
STARTUPINFO suInfo;
......@@ -170,12 +170,13 @@ void SystemCall(char *command)
Msg(INFO, "Calling '%s'", command);
CreateProcess(NULL, command, NULL, NULL, FALSE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &suInfo, &prInfo);
return 0;
#else
if(!system(NULL)) {
Msg(GERROR, "Could not find /bin/sh: aborting system call");
return;
return 1;
}
Msg(INFO, "Calling '%s'", command);
system(command);
return system(command);
#endif
}
......@@ -29,6 +29,6 @@ int GetProcessId();
int UnlinkFile(char *name);
int StatFile(char *filename);
int KillProcess(int pid);
void SystemCall(char *command);
int SystemCall(char *command);
#endif
// $Id: GModel.cpp,v 1.41 2007-05-02 07:59:27 geuzaine Exp $
// $Id: GModel.cpp,v 1.42 2007-05-23 15:35:33 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -494,10 +494,14 @@ void GModel::checkMeshCoherence()
Msg(INFO, "Checking mesh coherence (%d elements)", numEle);
SBoundingBox3d bb = bounds();
double lc = bb.empty() ? 1. : norm(SVector3(bb.max(), bb.min()));
double tol = CTX.geom.tolerance * lc;
// check for duplicate mesh vertices
{
double old_tol = MVertexLessThanLexicographic::tolerance;
MVertexLessThanLexicographic::tolerance = CTX.geom.tolerance;
MVertexLessThanLexicographic::tolerance = tol;
std::set<MVertex*, MVertexLessThanLexicographic> pos;
int num = 0;
for(viter it = firstVertex(); it != lastVertex(); ++it)
......@@ -515,7 +519,7 @@ void GModel::checkMeshCoherence()
// check for duplicate elements
{
double old_tol = MElementLessThanLexicographic::tolerance;
MElementLessThanLexicographic::tolerance = CTX.geom.tolerance;
MElementLessThanLexicographic::tolerance = tol;
std::set<MElement*, MElementLessThanLexicographic> pos;
int num = 0;
for(eiter it = firstEdge(); it != lastEdge(); ++it)
......
// $Id: OpenFile.cpp,v 1.147 2007-05-05 12:35:19 geuzaine Exp $
// $Id: OpenFile.cpp,v 1.148 2007-05-23 15:35:33 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -311,7 +311,8 @@ int MergeFile(char *name, int warn_if_missing)
"Cancel", "Uncompress", NULL, name)){
char tmp[256];
sprintf(tmp, "gunzip -c %s > %s", name, base);
SystemCall(tmp);
if(SystemCall(tmp))
Msg(GERROR, "Failed to uncompress `%s': check directory permissions", name);
if(!strcmp(CTX.filename, name)) // this is the project file
SetProjectName(base);
return MergeFile(base);
......
$Id: TODO,v 1.58 2007-05-10 22:08:06 geuzaine Exp $
$Id: TODO,v 1.59 2007-05-23 15:35:33 geuzaine Exp $
********************************************************************
add cleanup fct to remove duplicate elements in
GModel->checkMeshCoherence
********************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment