|
[Sponsors] |
April 8, 2009, 03:52 |
combineCells?
|
#1 |
Member
Virginie Ehrlacher
Join Date: Mar 2009
Posts: 52
Rep Power: 17 |
Hello,
I would have liked to know if there was a directTopoAction which could be used with directTopoChange which could merge two neighbouring cells into one and delete their initially shared faces? I saw that there was a combineFaces action which does the same thing for faces. Otherwise, would you give me some advice about how to encode such a class? What other class would you advise me to look at to have a better idea of how to code a directTopoAction which would do what I need? Thank you a lot. Virginie |
|
April 10, 2009, 07:36 |
|
#2 |
Member
Virginie Ehrlacher
Join Date: Mar 2009
Posts: 52
Rep Power: 17 |
Hello,
I have tried to use the function removeCell of directTopoChange removeCell(label cell, label mergeCell). I have a few questions about it: -what does this function excatly do? Does it create a resulting cell which possesses the same label as mergeCell but which is delimited also by the faces of cell? Are the common faces deleted? - I have tried to set a function to merge two cells with the following programm: void freeSurfaceGiulianiMerge::mergeCells(label cell, label mergeCell) { directTopoChange* topo1 = new directTopoChange(mesh()); directTopoChange& topo = *topo1; topo.removeCell(cell, mergeCell); autoPtr<mapPolyMesh> map = topo.changeMesh(mesh(), false); updateMesh(map); } // Update mesh corresponding to the given map void freeSurfaceGiulianiMerge::updateMesh(const mapPolyMesh& mpm) { // Delete oldPoints in polyMesh //mesh_.resetMotion(); // Update polyMesh. mesh_.updateMesh(mpm); // Clear out surface-interpolation //surfaceInterpolation::movePoints(); // Clear-out fvMesh geometry and addressing //mesh_.clearOut(); // Update topology for all registered classes meshObjectBase::allUpdateTopology<fvMesh>(mesh_); // Map all fields mapFields(mpm); Info << " mapFields(mpm);" << endl; } // Map all fields in time using the given map void freeSurfaceGiulianiMerge::mapFields(const mapPolyMesh& meshMap) { if (debug) { Info << "void freeSurfaceGiulianiMerge::mapFields(const mapPolyMesh& meshMap): " << "Mapping fvFields." << endl; } //- Field mapping class fvMeshMapper fieldMapper(mesh_,meshMap); // Map all the volFields in the objectRegistry MapGeometricFields<scalar, fvPatchField, fvMeshMapper, volMesh> (fieldMapper); MapGeometricFields<vector, fvPatchField, fvMeshMapper, volMesh> (fieldMapper); // Map all the surfaceFields in the objectRegistry MapGeometricFields<scalar, fvsPatchField, fvMeshMapper, surfaceMesh> (fieldMapper); // Old volumes are not mapped since interpolation is // performed at the same time level. } which is inspired from a class by Sandeep Menon. However, I got the following error: *** glibc detected *** double free or corruption (out): 0x000000000065c770 *** which occurs when the function autoPtr<mapPolyMesh> map = topo.changeMesh(mesh(), false); is used. Have you got an idea what this could be due to? Thank you a lot. Virginie |
|
April 13, 2009, 18:02 |
|
#3 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
Looks like the destructor / delete operator is called on a pointer that's already been deallocated. autoPtr is designed to delete it's contents when it goes out of scope, so the only way to figure it out is to step-through and debug using gdb.
|
|
May 11, 2009, 02:38 |
|
#4 |
Senior Member
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19 |
Hi Virginie,
could you manage the combine-work? One can probably use the available multigrid functions for this... but I do not know how!? Fabian |
|
May 11, 2009, 03:14 |
|
#5 |
Member
Virginie Ehrlacher
Join Date: Mar 2009
Posts: 52
Rep Power: 17 |
Hi Fabian,
What I managed to do is a function which combines two cells belonging to the same patch (freeSurface as I am using interTrackFoam) but so far it only works in 2D and it still has bugs sometimes... However, I can send you my class if you are interested. Perhaps it might help you? If yes, could you give me your e-mail address? Virginie |
|
|
|