From 7ceda2c282c0aa3199f9817811dd9b5c905dd5fd Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 7 Feb 2014 07:46:56 +0000 Subject: [PATCH] oops --- Geo/ACISVertex.cpp | 2 +- Geo/GModelIO_CELUM.cpp | 75 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 6 deletions(-) diff --git a/Geo/ACISVertex.cpp b/Geo/ACISVertex.cpp index 366bd832ef..58d2439f75 100644 --- a/Geo/ACISVertex.cpp +++ b/Geo/ACISVertex.cpp @@ -33,7 +33,7 @@ void ACISVertex::setPosition(GPoint &p) SPoint2 ACISVertex::reparamOnFace(const GFace *gf, int dir) const { - // FIXME there is definitively a fastest way to do it and this is wring for seams и!!! + // FIXME there is definitively a fastest way to do it and this is wring for seams! return gf->parFromPoint(SPoint3(x(),y(),z())); } diff --git a/Geo/GModelIO_CELUM.cpp b/Geo/GModelIO_CELUM.cpp index 5864112c3f..74a29cb61f 100644 --- a/Geo/GModelIO_CELUM.cpp +++ b/Geo/GModelIO_CELUM.cpp @@ -1,4 +1,4 @@ -// Gmsh - Copyright (C) 1997-2014 C. Geuzaine, J.-F. Remacle +// Gmsh - Copyright (C) 1997-2013 C. Geuzaine, J.-F. Remacle // // See the LICENSE.txt file for license information. Please report all // bugs and problems to the public mailing list <gmsh@geuz.org>. @@ -52,7 +52,72 @@ int GModel::writeCELUM(const std::string &name, bool saveAll, int idf = 1, ids = 1; /* - * un fichier de facettes - - nombre de facettes - - ligne vide - ... pour chaque facette + * a file with faces + - number of faces + - empty line + ... for each face + - number of the face (starts at 1 : used for read errors) + - char string (name of geom part, material,... ) + - list of 3 vertex nums + - empty line + ... + * a file with vertices + - number of vertices + - conversion factor + - empty line + ... for each vertex + - number of the vertex (starts at 1 : used for read errors) + - cartesian coordinates of the vertex + - componants of the exterior oriented normal + - value of 1st principal curvature + - value of second princpal curvature + - components of 1st principal direction + - components of 2nd principal direction + - empty line + ... + */ + fprintf(fpf, "%d\n\n", numf); + fprintf(fps, "%d %g\n\n", nums, 1.0); + for(fiter it = firstFace(); it != lastFace(); it++){ + GFace *f = *it; + if(!saveAll && f->physicals.empty()) continue; + std::vector<MVertex*> vvec; + std::map<MVertex*, CelumInfo> vmap; + for(unsigned int i = 0; i < f->triangles.size(); i++){ + fprintf(fpf, "%d \"face %d\"", idf++, f->tag()); + for(int j = 0; j < 3; j++){ + MVertex *v = f->triangles[i]->getVertex(j); + if(!vmap.count(v)){ + v->setIndex(ids++); + SPoint2 param; + bool ok = reparamMeshVertexOnFace(v, f, param); + if(!ok) + Msg::Warning("Could not reparamtrize vertex %d on face %d", + v->getNum(), f->tag()); + CelumInfo info; + info.normal = f->normal(param); + f->curvatures(param, &info.dirMax, &info.dirMin, + &info.curvMax, &info.curvMin); + vmap[v] = info; + vvec.push_back(v); + } + fprintf(fpf, " %d", v->getIndex()); + } + fprintf(fpf, "\n\n"); + } + for(unsigned int i = 0; i < vvec.size(); i++){ + MVertex *v = vvec[i]; + std::map<MVertex *, CelumInfo>::iterator it = vmap.find(v); + fprintf(fps, "%d %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n\n", + it->first->getIndex(), it->first->x(), it->first->y(), it->first->z(), + it->second.normal.x(), it->second.normal.y(), + it->second.normal.z(), it->second.curvMin, it->second.curvMax, + it->second.dirMin.x(), it->second.dirMin.y(), it->second.dirMin.z(), + it->second.dirMax.x(), it->second.dirMax.y(), it->second.dirMax.z()); + } + } + + fclose(fpf); + fclose(fps); + return 1; +} -- GitLab