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

pp

parent 219b9934
No related branches found
No related tags found
No related merge requests found
// $Id: meshGRegionDelaunayInsertion.cpp,v 1.37 2008-02-21 12:11:12 geuzaine Exp $ // $Id: meshGRegionDelaunayInsertion.cpp,v 1.38 2008-03-04 08:51:14 geuzaine Exp $
// //
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
......
#ifndef _DELAUNAYINSERTION_H_ #ifndef _MESH_GREGION_DELAUNAY_INSERTION_H_
#define _DELAUNAYINSERTION_H_ #define _MESH_GREGION_DELAUNAY_INSERTION_H_
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
// //
// Please report all bugs and problems to <gmsh@geuz.org>. // Please report all bugs and problems to <gmsh@geuz.org>.
#include "MElement.h"
#include "qualityMeasures.h"
#include <list> #include <list>
#include <set> #include <set>
#include <map> #include <map>
#include <stack> #include <stack>
#include "MElement.h"
#include "qualityMeasures.h"
//#define _GMSH_PRE_ALLOCATE_STRATEGY_ 1 //#define _GMSH_PRE_ALLOCATE_STRATEGY_ 1
class GRegion; class GRegion;
...@@ -34,49 +34,45 @@ class GModel; ...@@ -34,49 +34,45 @@ class GModel;
class MTet4Factory; class MTet4Factory;
// sizeof(MTet4) = 36 Bytes and sizeof(MTetrahedron) = 28 Bytes, so
// normally it should take 36+28 = 64 MByte per million tets. We also
// store a rb tree containing all pointers sorted with respect to tet
// radius. Each bucket of the tree contain 4 pointers, i.e. 16 Bytes
// plus the data -> Extra cost of 20 Bytes/Tet, i.e., 84 MB per
// million tets. A MVertex has a cost of 44 Bytes and there are about
// 200000 of them per million tet, i.e., a new cost of 9MB per million
// tets.
// Grand total should be 92 MB per million tet (I observe 160M MB!)
class MTet4 class MTet4
{ {
friend class MTet4Factory; friend class MTet4Factory;
// a total of 36 Bytes for a MTet4 private:
// Normally it should take 36 MByte in excess per million of tets
// 36 MB for 10e6 Tets
// Each MTetrahedron has a size of 28 Bytes
// The total memory required for a tet is 64 Bytes
// i.e. 64 MB per 10e6 Tet
// Yet, we store also a rb tree containing all pointers
// sorted with respect to tet radius.
// each bucket of the tree contain 4 pointers, i.e. 16 Bytes plus
// the data. We have therefor an extra cost of 20 Bytes/Tet
// i.e. 84 MB/ million tets
// A MVertex has a cost of 40 Bytes and there are about 200000 of them
// per million tet: a new cost of 8MB/10e6 tet : total 92 MB/10e6 tet
// (I observe 160M MB !!!)
bool deleted; bool deleted;
double circum_radius; double circum_radius;
MTetrahedron *base; MTetrahedron *base;
MTet4 *neigh[4]; MTet4 *neigh[4];
GRegion *gr; GRegion *gr;
public : public :
~MTet4(){} ~MTet4(){}
MTet4() : deleted(false), circum_radius(0.0), base(0), gr(0) MTet4()
: deleted(false), circum_radius(0.0), base(0), gr(0)
{ {
neigh[0] = neigh[1] = neigh[2] = neigh[3] = 0; neigh[0] = neigh[1] = neigh[2] = neigh[3] = 0;
} }
MTet4(MTetrahedron *t, double qual) : deleted(false), circum_radius(qual), base(t), gr(0) MTet4(MTetrahedron *t, double qual)
: deleted(false), circum_radius(qual), base(t), gr(0)
{ {
neigh[0] = neigh[1] = neigh[2] = neigh[3] = 0; neigh[0] = neigh[1] = neigh[2] = neigh[3] = 0;
} }
MTet4(MTetrahedron *t, const gmshQualityMeasure4Tet &qm) : deleted(false), base(t), gr(0) MTet4(MTetrahedron *t, const gmshQualityMeasure4Tet &qm)
: deleted(false), base(t), gr(0)
{ {
neigh[0] = neigh[1] = neigh[2] = neigh[3] = 0; neigh[0] = neigh[1] = neigh[2] = neigh[3] = 0;
double vol; double vol;
circum_radius = qmTet(t, qm, &vol); circum_radius = qmTet(t, qm, &vol);
} }
void setup(MTetrahedron *t, std::vector<double> &sizes) void setup(MTetrahedron *t, std::vector<double> &sizes)
{ {
base = t; base = t;
...@@ -87,7 +83,6 @@ class MTet4 ...@@ -87,7 +83,6 @@ class MTet4
const double dy = base->getVertex(0)->y() - center[1]; const double dy = base->getVertex(0)->y() - center[1];
const double dz = base->getVertex(0)->z() - center[2]; const double dz = base->getVertex(0)->z() - center[2];
circum_radius = sqrt(dx * dx + dy * dy + dz * dz); circum_radius = sqrt(dx * dx + dy * dy + dz * dz);
double lc = 0.25 * (sizes[base->getVertex(0)->getNum()] + double lc = 0.25 * (sizes[base->getVertex(0)->getNum()] +
sizes[base->getVertex(1)->getNum()] + sizes[base->getVertex(1)->getNum()] +
sizes[base->getVertex(2)->getNum()] + sizes[base->getVertex(2)->getNum()] +
...@@ -95,10 +90,8 @@ class MTet4 ...@@ -95,10 +90,8 @@ class MTet4
circum_radius /= lc; circum_radius /= lc;
deleted = false; deleted = false;
} }
inline GRegion *onWhat () const { return gr; } inline GRegion *onWhat () const { return gr; }
inline void setOnWhat (GRegion *g) { gr = g; } inline void setOnWhat (GRegion *g) { gr = g; }
bool isDeleted () const { return deleted; } bool isDeleted () const { return deleted; }
void forceRadius (double r){ circum_radius = r; } void forceRadius (double r){ circum_radius = r; }
inline double getRadius () const { return circum_radius; } inline double getRadius () const { return circum_radius; }
...@@ -118,11 +111,9 @@ class MTet4 ...@@ -118,11 +111,9 @@ class MTet4
{ {
return inCircumSphere(v->x(), v->y(), v->z()); return inCircumSphere(v->x(), v->y(), v->z());
} }
double getVolume() const { return base->getVolume(); }
double getVolume () const { return base -> getVolume() ; };
inline void setDeleted(bool d) inline void setDeleted(bool d)
{ {
// circum_radius = d ? fabs(circum_radius) : fabs(circum_radius)
deleted = d; deleted = d;
} }
inline bool assertNeigh() const inline bool assertNeigh() const
...@@ -132,14 +123,12 @@ class MTet4 ...@@ -132,14 +123,12 @@ class MTet4
if (neigh[i] && (neigh[i]->isNeigh(this) == false)) return false; if (neigh[i] && (neigh[i]->isNeigh(this) == false)) return false;
return true; return true;
} }
inline bool isNeigh(const MTet4 *t) const inline bool isNeigh(const MTet4 *t) const
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
if (neigh[i] == t) return true; if (neigh[i] == t) return true;
return false; return false;
} }
}; };
void connectTets(std::list<MTet4*> &); void connectTets(std::list<MTet4*> &);
...@@ -168,7 +157,6 @@ private: ...@@ -168,7 +157,6 @@ private:
MTet4* allSlots; MTet4* allSlots;
int s_last, s_alloc; int s_last, s_alloc;
std::stack<MTet4*> emptySlots; std::stack<MTet4*> emptySlots;
inline MTet4 *getANewSlot() inline MTet4 *getANewSlot()
{ {
if (s_last >= s_alloc) return 0; if (s_last >= s_alloc) return 0;
...@@ -178,8 +166,7 @@ private: ...@@ -178,8 +166,7 @@ private:
} }
inline MTet4 *getAnEmptySlot() inline MTet4 *getAnEmptySlot()
{ {
if(!emptySlots.empty()) if(!emptySlots.empty()){
{
MTet4* t = emptySlots.top(); MTet4* t = emptySlots.top();
emptySlots.pop(); emptySlots.pop();
return t; return t;
...@@ -187,8 +174,6 @@ private: ...@@ -187,8 +174,6 @@ private:
return getANewSlot(); return getANewSlot();
}; };
#endif #endif
public : public :
MTet4Factory(int _size = 1000000) MTet4Factory(int _size = 1000000)
{ {
...@@ -197,7 +182,8 @@ private: ...@@ -197,7 +182,8 @@ private:
allSlots = new MTet4[s_alloc]; allSlots = new MTet4[s_alloc];
#endif #endif
} }
~MTet4Factory () { ~MTet4Factory ()
{
#ifdef _GMSH_PRE_ALLOCATE_STRATEGY_ #ifdef _GMSH_PRE_ALLOCATE_STRATEGY_
delete [] allSlots; delete [] allSlots;
#endif #endif
...@@ -223,7 +209,6 @@ private: ...@@ -223,7 +209,6 @@ private:
delete t; delete t;
#endif #endif
} }
void changeTetRadius(iterator it, double r) void changeTetRadius(iterator it, double r)
{ {
MTet4 *t = *it; MTet4 *t = *it;
...@@ -232,7 +217,6 @@ private: ...@@ -232,7 +217,6 @@ private:
allTets.insert(t); allTets.insert(t);
} }
container &getAllTets(){ return allTets; } container &getAllTets(){ return allTets; }
}; };
void gmshOptimizeMesh(GRegion *gr, const gmshQualityMeasure4Tet &qm); void gmshOptimizeMesh(GRegion *gr, const gmshQualityMeasure4Tet &qm);
......
// $Id: PViewDataGModel.cpp,v 1.20 2008-02-25 15:36:38 geuzaine Exp $ // $Id: PViewDataGModel.cpp,v 1.21 2008-03-04 08:51:14 geuzaine Exp $
// //
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
...@@ -56,7 +56,7 @@ PViewDataGModel::PViewDataGModel(GModel *model) : _model(model) ...@@ -56,7 +56,7 @@ PViewDataGModel::PViewDataGModel(GModel *model) : _model(model)
nodeData[step].values.resize(numDataInFile); nodeData[step].values.resize(numDataInFile);
loop over lines: loop over lines:
* get node number in file * get node number in file
* get vertex pointer from _model->getVertexByTag(num) * get vertex pointer from _model->getMeshVertexByTag(num)
* if MVertex has no dataIndex: * if MVertex has no dataIndex:
increment it (need global value stored in GModel) increment it (need global value stored in GModel)
else else
...@@ -67,9 +67,10 @@ PViewDataGModel::PViewDataGModel(GModel *model) : _model(model) ...@@ -67,9 +67,10 @@ PViewDataGModel::PViewDataGModel(GModel *model) : _model(model)
.msh file format: .msh file format:
$NodeData $NodeData
name precision-single-double step time-value "name"
type node-or-ele-id num-comp val (num-comp times) time-step time-value precision num-components num-nodes
type node-or-ele-id num-comp val (num-comp times) num-node values...
num-node values...
... ...
$EndNodeData $EndNodeData
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment