#ifndef __CPM__VTK__THREADEDDEFORMATION__HXX__ #define __CPM__VTK__THREADEDDEFORMATION__HXX__ #include // ------------------------------------------------------------------------- template< class F > typename cpm::VTK::ThreadedDeformation< F >:: Self* cpm::VTK::ThreadedDeformation< F >:: New( ) { return( new Self( ) ); } // ------------------------------------------------------------------------- template< class F > void cpm::VTK::ThreadedDeformation< F >:: InitThreadSupport( ) { #ifdef CPM_VTK_THREADEDDEFORMATION_ON_LINUX XInitThreads( ); #endif } // ------------------------------------------------------------------------- template< class F > int cpm::VTK::ThreadedDeformation< F >:: ExecuteFilter( F* filter, vtkRenderWindow* window ) { static _TData data; data.first = filter; data.second = window; return( this->SpawnThread( Self::_Function, &data ) ); } // ------------------------------------------------------------------------- template< class F > cpm::VTK::ThreadedDeformation< F >:: ThreadedDeformation( ) : Superclass( ) { } // ------------------------------------------------------------------------- template< class F > cpm::VTK::ThreadedDeformation< F >:: ~ThreadedDeformation( ) { } // ------------------------------------------------------------------------- template< class F > void* cpm::VTK::ThreadedDeformation< F >:: _Function( void* arg ) { typedef cpm::VTK::ThreadedDeformationObserver< F > _TObserver; typedef Superclass::ThreadInfo _TInfo; typedef typename F::AllMeshUpdatedEvent _TEvt; // Get inputs _TInfo* info = reinterpret_cast< _TInfo* >( arg ); if( info == NULL ) return( 0 ); _TData* data = reinterpret_cast< _TData* >( info->UserData ); if( data == NULL ) return( 0 ); F* filter = data->first; vtkRenderWindow* window = data->second; // Add observers, execute and remove observers typename _TObserver::Pointer obs = _TObserver::New( ); obs->Configure( window ); unsigned long id = filter->AddObserver( _TEvt( ), obs ); filter->Update( ); filter->RemoveObserver( id ); return( 0 ); } #endif // __CPM__VTK__THREADEDDEFORMATION__HXX__ // eof - $RCSfile$