SPModel: plugins/flowHierarchyViewer/FlowHierarchyViewer.c Source File
VPAC - Computational Software Development
Main | SPModel | StGermain FrameWork |
Main Page | Alphabetical List | Class List | Directories | File List | Class Members | File Members

FlowHierarchyViewer.c

Go to the documentation of this file.
00001 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00002 **
00003 ** Copyright (C), 2004, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
00004 **
00005 ** Authors:
00006 **  Ogar R. Widjaja, Computational Scientist, VPAC.
00007 **  Raquibul Hassan, Software Engineer, VPAC. (raq@vpac.org)
00008 **  Keith Hsuan, Computational Scientist, VPAC (keith@vpac.org)
00009 **  William F. Appelbe, Director, VPAC. (bill@vpac.org)
00010 **  Stevan M. Quenette, Senior Software Engineer, VPAC. (steve@vpac.org)
00011 **  Patrick D. Sunter, Software Engineer, VPAC. (patrick@vpac.org)
00012 **
00013 ** This file may be distributed under the terms of the VPAC Public License
00014 ** as defined by VPAC of Australia and appearing in the file
00015 ** LICENSE.VPL included in the packaging of this file.
00016 **
00017 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00018 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00019 **
00020 ** $Id: FlowHierarchyViewer.c 232 2006-01-10 00:03:11Z RaquibulHassan $
00021 **
00022 **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
00023 
00024 
00025 #include <mpi.h>
00026 #include <StGermain/StGermain.h>
00027 #include <stdlib.h>
00028 #include <string.h>
00029 #include "SPModel/SPModel.h"
00030 
00031 
00032 #include "FlowHierarchyViewer.h"
00033 
00034 #include "visualization.h"
00035 
00036 /* Textual name of this module */
00037 const Type SPModelFlowHierarchyViewer_Type = "SPModelFlowHierarchyViewer";
00038 
00039 void* _SPModelFlowHierarchyViewer_DefaultNew( Name name ) {
00040     return Codelet_New(
00041             SPModelFlowHierarchyViewer_Type,
00042             _SPModelFlowHierarchyViewer_DefaultNew,
00043             _SPModelFlowHierarchyViewer_Construct,
00044             _Codelet_Build,
00045             _Codelet_Initialise,
00046             _Codelet_Execute,
00047             _Codelet_Destroy,
00048             name );
00049 }
00050 
00051 void _SPModelFlowHierarchyViewer_Construct( void* component, Stg_ComponentFactory* data ) { 
00052     SPModel_Context*                context;
00053 
00054     context = (SPModel_Context*)Stg_ComponentFactory_ConstructByName( data, "context", SPModel_Context, True );
00055     
00056     _SPModelFlowHierarchyViewer_Init( context );
00057     
00058     Journal_DPrintf( context->debug, "In %s():\n", __func__ );
00059     ContextEP_Append( context, AbstractContext_EP_IC, _SPModelFlowHierarchyViewer_Init );
00060     ContextEP_Append( context, AbstractContext_EP_FrequentOutput, SPModelFlowHierarchyViewer_UpdateView );
00061 }   
00062 
00063 void _SPModelFlowHierarchyViewer_Init( void* _context ) {
00064     SPModel_Context*                context = (SPModel_Context*)_context;
00065 
00066     if (context->rank == 0) {
00067         createGLWindow(context);
00068     }
00069 }
00070 
00071 void SPModelFlowHierarchyViewer_UpdateView( void* _context ) {
00072     SPModel_Context*                context = (SPModel_Context*)_context;
00073     
00074     _SPModel_Context_Gather( context );
00075     if (context->rank == 0)
00076     {
00077         /* windowEvents calls dumpNodes inside an infinite loop and quits when the user presses ESC */
00078         windowEvents(_context);
00079     }
00080 }
00081 
00082 Index SPModelFlowHierarchyViewer_Register( PluginsManager* pluginsManager ) {
00083     return PluginsManager_Submit( pluginsManager, SPModelFlowHierarchyViewer_Type, "0", _SPModelFlowHierarchyViewer_DefaultNew );
00084 }
00085