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

I borked the smooth plugin with my cleanups: this fixes it
parent 33e9e089
No related branches found
No related tags found
No related merge requests found
// $Id: Views.cpp,v 1.184 2006-01-28 21:13:35 geuzaine Exp $ // $Id: Views.cpp,v 1.185 2006-02-01 02:11:02 geuzaine Exp $
// //
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// //
...@@ -901,6 +901,37 @@ struct xyzv { ...@@ -901,6 +901,37 @@ struct xyzv {
xyzv(double xx, double yy, double zz) xyzv(double xx, double yy, double zz)
: x(xx), y(yy), z(zz), vals(0), nbvals(0), nboccurences(0) {} : x(xx), y(yy), z(zz), vals(0), nbvals(0), nboccurences(0) {}
~xyzv(){ if(vals) delete [] vals; } ~xyzv(){ if(vals) delete [] vals; }
// the following two are needed for set<> operations, since the
// default copy ctor won't allocate *vals
xyzv(const xyzv & other)
{
x = other.x;
y = other.y;
z = other.z;
nbvals = other.nbvals;
nboccurences = other.nboccurences;
if(other.vals && other.nbvals) {
vals = new double[other.nbvals];
for(int i = 0; i < nbvals; i++)
vals[i] = other.vals[i];
}
}
xyzv & operator =(const xyzv &other)
{
if(this != &other) {
x = other.x;
y = other.y;
z = other.z;
nbvals = other.nbvals;
nboccurences = other.nboccurences;
if(other.vals && other.nbvals) {
vals = new double[other.nbvals];
for(int i = 0; i < nbvals; i++)
vals[i] = other.vals[i];
}
}
return *this;
}
void update(int n, double *v) void update(int n, double *v)
{ {
if(!vals) { if(!vals) {
...@@ -945,21 +976,18 @@ typedef xyzv_cont::const_iterator xyzv_iter; ...@@ -945,21 +976,18 @@ typedef xyzv_cont::const_iterator xyzv_iter;
void generate_connectivities(List_T * list, int nbList, int nbTimeStep, int nbVert, void generate_connectivities(List_T * list, int nbList, int nbTimeStep, int nbVert,
xyzv_cont & connectivities) xyzv_cont & connectivities)
{ {
double *x, *y, *z, *v;
int i, j, k;
if(!nbList) return; if(!nbList) return;
double *vals = new double[nbTimeStep]; double *vals = new double[nbTimeStep];
int nb = List_Nbr(list)/nbList; int nb = List_Nbr(list)/nbList;
for(i = 0; i < List_Nbr(list); i += nb) { for(int i = 0; i < List_Nbr(list); i += nb) {
x = (double *)List_Pointer_Fast(list, i); double *x = (double *)List_Pointer_Fast(list, i);
y = (double *)List_Pointer_Fast(list, i + nbVert); double *y = (double *)List_Pointer_Fast(list, i + nbVert);
z = (double *)List_Pointer_Fast(list, i + 2 * nbVert); double *z = (double *)List_Pointer_Fast(list, i + 2 * nbVert);
v = (double *)List_Pointer_Fast(list, i + 3 * nbVert); double *v = (double *)List_Pointer_Fast(list, i + 3 * nbVert);
for(j = 0; j < nbVert; j++) { for(int j = 0; j < nbVert; j++) {
for(k = 0; k < nbTimeStep; k++) for(int k = 0; k < nbTimeStep; k++)
vals[k] = v[j + k * nbVert]; vals[k] = v[j + k * nbVert];
xyzv xyz(x[j], y[j], z[j]); xyzv xyz(x[j], y[j], z[j]);
xyzv_iter it = connectivities.find(xyz); xyzv_iter it = connectivities.find(xyz);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment