[Insight-developers] AutomaticTopologyMeshSource

Luis Ibanez luis.ibanez@kitware.com
Thu, 15 May 2003 14:34:57 -0400


Hi Mark,

Yeap, that may be a problem for multi-threading, if two
different threads are adding cells to the mesh simultaneously.

However, the alternative of making this thread-safe will kill
the performance of the cell insertiion since you will have to
call a Mutex each time.

It is problably fair just to mention this in the documentaiton.
In any case, the current approach is not thread safe either, so
your additions are still an improvement.


Luis

----------------------------------------------------


Mark Foskey wrote:
> Yeah, this came up when I was testing it.  The way I have it now, 
> Update() is overridden to be a no-op, and the class makes sure that the 
> mesh is in a valid state after every AddFoo call.  Does this raise 
> problems with thread safety?
> 
> Luis Ibanez wrote:
> 
>>
>> Hi Mark,
>>
>> This sounds like a great idea.
>>
>> I'm not sure if this should be a MeshSource, since there will be
>> an Update() method but the actual construction of the Mesh is
>> done through calls to AddTriangle, AddLine... and so on.
>>
>> Maybe it will be enough to document the class to make clear that
>> all the invokations to AddTriangle() should be done before calling
>> Update().
>>
>>
>>
>>   Luis
>>
>>
>> -------------------
>> Mark Foskey wrote:
>>
>>> I am writing a mesh source to make it easier to create meshes.  The 
>>> idea is that you should be able to call
>>>
>>> meshSource->AddTriangle( p0, p1, p2 );
>>> meshSource->AddTriangle( p1, p2, p3 );
>>>
>>> where p0, ..., p3 are already-defined points, and the meshSource will 
>>> add the appropriate points, VertexCells, LineCells, and TriangleCells 
>>> for a full K-complex, being sure not to add any object more than once.
>>>
>>> I intend to have AddFoo methods for each of the currently supported 
>>> CellTypes.
>>>
>>> It seems that this may be useful in a number of places.  I want it to 
>>> facilitate the implementation of medial surface extraction, but it 
>>> can also be convenient when importing mesh data from an arbitrary 
>>> format.
>>>
>>> There will also be methods of the form AddTriangle( id1, id2, id3 ), 
>>> where the id's are identifiers for points that have already been added.
>>>
>>> I have looked around and it doesn't seem like ITK already has 
>>> anything that does this, but I'd like to know if I'm duplicating any 
>>> effort, or if there are any objections to the idea of such a class.
>>>
>>> I plan to check in a partial version in the next couple of days for 
>>> testing purposes; I have a running test program but you can only add 
>>> points and vertex cells.
>>>
>>
>>
>>
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers@public.kitware.com
>> http://public.kitware.com/mailman/listinfo/insight-developers
> 
> 
>