## Model Cleaning for CFD Use

graphics

### Next

• 1. Simplified quicksort algorithm.
Hello, I'm asking in this group because there is no regular *.algorithms group, sorry. I'm trying to uderstand the algorithm from McConnel book. It's Quicksort(list, first, last) begin if first < last then pivot = PivotList(list, first, last); Quicksort(list, first, pivot - 1); Quicksort(list, pivot + 1, last); endif end and PivotList function: PivotList(list, first, last); begin PivotValue = list[first]; PivotPoint = first; for index = fisrt + 1 to last do if list[index] < PivotValue then PivotPoint = PivotPoint + 1; Swap(list[PivotPoint], list[index]); endif end do Swap(list[first], list[PivotPoint]); return PivotPoint; end If that is correct then PivotList function do Swap(list[fisrt + 1], list[first + 1]) (it's stupid!) if we encounter element that lesser pivot and occupies the position right after pivot. I thought there was a mistake Swap() first and then PivotPoint = PivotPoint + 1; But it seems to me as not-working solution too because we're going to loose *real* PivotPoint right after encountering element that greater than PivotValue. Please help me to understand this. Thank you.

### Model Cleaning for CFD Use

```Hi,

I would like to use Gerris and/or OpenFoam to test the aerodynamics of
motorcycle bodywork.  The problem that I am having is that the 3d models
that I've found aren't suitable because they contain duplicate edges,
adjacent triangles don't share edges, the model isn't "watertight,"
hidden faces, etc.  I'm not even sure of the terminology here so I hope
I'm being clear enough.

I've read of some "shrinkwrap" algorithms that create a mesh that is
watertight but has the same shape as the original model.  This seems to
be what I want for the CFD programs.

So, how do I fix these models?  I guess I'm just looking for some clues
some software and have a mesh I can use.  I'd appreciate it if you could
point me to some software or descriptions of algorithms that will clean
a mesh.  For that matter, I don't even know if what I want to do is
feasable - it could be that I'll need to open a file in Meshlab and fix
each one of 20,000 triangles.

Thanks,

Dennis
```

### Re: Model Cleaning for CFD Use

```On 2010-07-07 08:54:57 +0530, Dennis Dunn < XXXX@XXXXX.COM > said:

Any CFD/FEA preprocessor should allow you to do node equivalencing to
merge the edges and nodes. I never used OpenFoam or Gerris so I cannot
comment on those. If you know the file format of the 3D model that you
are trying to use, you can write a program to fix it. Most mesh file
formats are usually simple to parse.

~ Sirius

```

```Hi,

I would like to use Gerris and/or OpenFoam to test the aerodynamics of
motorcycle bodywork.  The problem that I am having is that the 3d models
that I've found aren't suitable because they contain duplicate edges,
adjacent triangles don't share edges, the model isn't "watertight,"
hidden faces, etc.  I'm not even sure of the terminology here so I hope
I'm being clear enough.

I've read of some "shrinkwrap" algorithms that create a mesh that is
watertight but has the same shape as the original model.  This seems to
be what I want for the CFD programs.

So, how do I fix these models?  I guess I'm just looking for some clues
some software and have a mesh I can use.  I'd appreciate it if you could
point me to some software or descriptions of algorithms that will clean
a mesh.  For that matter, I don't even know if what I want to do is
feasable - it could be that I'll need to open a file in Meshlab and fix
each one of 20,000 triangles.

Thanks,

Dennis
```

```Ok.. so I tried to take my first step to create a 3D object with VertexBuffers but I have a problem cleaning up. For some reason, after I do CreateVertexBuffer call and I try to exit the application, it keeps saying "reference count for D3D object is non-null". I am releasing the vertex buffer before I exit the application, and I'm using D3DPOOL_MANAGED for vertex buffer.
Am I missing an important step here? Tutorial doesn't really have any special clean up either but it works fine for tutorials and samples. If anyone can give me few pointers or things to watch out for, I would appreciate it. Or if anyone can tell me what I"m doing wrong, that would even be better. ^^; Thanks.
```

```Does anyone know how to get a copy of DIVA (from msstate)?

Thanks,
Louis

```