Commits

Matt Knepley committed cd5cdab Merge

Comments (0)

Files changed (11)

src/dm/mesh/sieve/XSifter.hh

     {};
   
     //
-    // InnerIndexSequence definition
-    // 
-    // Defines a sequence representing a subset of a multi_index container defined by its Index_, which is ordered lexicographically
-    // starting with Key_, obtained using KeyExtractor_.
-    // A sequence defines output iterators (input iterators in std terminology) for traversing an Index_ object.
-    // These traverse the subset of Index_ with the fixed Key_, that is all the entries lexicographically "within" the Key_ segment.
-    // Upon dereferencing values are extracted from each result record using a ValueExtractor_ object.
-    // template <typename Index_, 
-    //               typename KeyExtractor_, typename ValueExtractor_ = ALE::template identity<typename Index_::value_type> 
-    //     >
-    //     struct InnerIndexSequence {
-    
-    //     };// class InnerIndexSequence    
-    
-    //
-    // OuterIndexSequence definition
-    // 
-    // Defines a sequence representing a subset of a multi_index container defined by its Index_ ordered lexicographically 
-    // starting with a Key_, obtained using a KeyExtractor_.
-    // A sequence defines output iterators (input iterators in std terminology) for traversing an Index_ object.
-    // This particular sequence picks out the first element in each segment with a given Key_;
-    // in other words, the sequence iterates over the Key_ values, rather than within a fixed Key_ segment.
-    // Upon dereferencing values are extracted from each result record using a ValueExtractor_ object.
-    //     template <typename Index_, typename Key_, typename ValueExtractor_ = ALE::template ::identity<typename Index_::value_type> >
-    //     struct OuterIndexSequence {
-    
-    //     };// class OuterIndexSequence    
-    
-
-    //
     // StridedIndexSequence definition
     // 
     // Defines a sequence representing a subset of a multi_index container defined by its Index_ which is ordered lexicographically 
     // the outer keys from a given range and a fixed inner key.
     // Upon dereferencing values are extracted from each result record using a ValueExtractor_ object.
     template <typename Index_, typename OuterKeyExtractor_, typename InnerKeyExtractor_, 
-              typename ValueExtractor_ = ALE::identity<typename Index_::value_type> >
+              typename ValueExtractor_ = ALE::identity<typename Index_::value_type>, bool inner_strided_flag = false >
     struct StridedIndexSequence {
-      // CONTINUE: need to rethink the design to accomodate sequences like BaseSequence
       typedef Index_                                           index_type;
       typedef OuterKeyExtractor_                               outer_key_extractor_type;
       typedef typename outer_key_extractor_type::result_type   outer_key_type;
         // FIX: operator*() should return a const reference, but it won't compile that way, because _ex() returns const value_type
         virtual const value_type  operator*() const {_ex(*(this->_itor));};
         virtual iterator   operator++() {
-          this->_sequence.next(this->_itor, this->_segBndry);
+          this->_sequence.next(this->_itor, this->_segBndry, inner_strided_flag);
           return *this;
         };
         virtual iterator   operator++(int n) {iterator tmp(*this); ++(*this); return tmp;};
         return iterator(*this, itor, segBndry);
       }; // begin()
       //
-      void next(itor_type& itor, itor_type& segBndry) {
-        // See if our advance would lead to breaching the segment boundary:
-        itor_type tmp_itor = ++(itor);
-        if(tmp_itor != segBndry) { 
-          // if not breached the segment boundary, simply use the advanced iterator
-          itor = tmp_itor;
+      void next(itor_type& itor, itor_type& segBndry, bool inner_strided = false) {
+        outer_key_type olow;
+        inner_key_type ilow;
+        // If iteration over inner keys is to be strided as well, we advance directly to the segment boundary.
+        // Effectively, we iterate over segments.
+        if(inner_strided) {
+          itor = segBndry;
+          // Finally, compute the new segment's boundary
+          // ASSUMPTION: index ordering operator can compare against (outer_key, inner_key) pairs
+          olow = this->_okex(*itor);
+          ilow = this->_ikex(*itor);
+          segBndry = this->_index.upper_bound(ALE::pair<outer_key_type, inner_key_type>(olow,ilow));
         }
+        // Otherwise, we iterate *within* a segment until its end is reached; then the following segment is started.
         else {
-          // Obtain the current outer key from itor:
-          outer_key_type olow = this->_okex(*itor);
-          // Compute the lower boundary of the new segment
-          // ASSUMPTION: index ordering operator can compare against outer_keys
-          itor = this->_index.upper_bound(olow);
-          // Extract the new outer key
-          olow = this->_okex(*itor);
-          // Now determine the inner lower limit and set the iterator to that limit within the new segment
-          inner_key_type ilow;
-          if(this->_have_ilow) {
-            ilow = this->_ilow;
-            // ASSUMPTION: index ordering operator can compare against (outer_key, inner_key) pairs
-            itor = this->_index.lower_bound(ALE::pair<outer_key_type, inner_key_type>(olow,ilow));
+          // See if our advance would lead to breaching the segment boundary:
+          itor_type tmp_itor = ++(itor);
+          if(tmp_itor != segBndry) { 
+            // if not breached the segment boundary, simply use the advanced iterator
+            itor = tmp_itor;
           }
           else {
-            // the itor is already in the right place; need to extract the ilow key
-            ilow = this->_ikex(*itor);
+            // Obtain the current outer key from itor:
+            olow = this->_okex(*itor);
+            // Compute the lower boundary of the new segment
+            // ASSUMPTION: index ordering operator can compare against outer_keys
+            itor = this->_index.upper_bound(olow);
+            // Extract the new outer key
+            olow = this->_okex(*itor);
+            // Now determine the inner lower limit and set the iterator to that limit within the new segment
+            if(this->_have_ilow) {
+              ilow = this->_ilow;
+              // ASSUMPTION: index ordering operator can compare against (outer_key, inner_key) pairs
+              itor = this->_index.lower_bound(ALE::pair<outer_key_type, inner_key_type>(olow,ilow));
+            }
+            else {
+              // the itor is already in the right place; need to extract the ilow key
+              ilow = this->_ikex(*itor);
+            }
+            // Finally, compute the new segment's boundary
+            // ASSUMPTION: index ordering operator can compare against (outer_key, inner_key) pairs
+            segBndry = this->_index.upper_bound(ALE::pair<outer_key_type, inner_key_type>(olow,ilow));
           }
-          // Finally, compute the new segment's boundary
-          // ASSUMPTION: index ordering operator can compare against (outer_key, inner_key) pairs
-          segBndry = this->_index.upper_bound(ALE::pair<outer_key_type, inner_key_type>(olow,ilow));
-        }
       };// next()
       //
       iterator end() {
     rec_set_type;
     //
     // Sequence types
-    template <typename Index_, typename OuterKeyExtractor_, typename InnerKeyExtractor_, typename ValueExtractor_>
-    class ArrowSequence : public SifterDef::StridedIndexSequence<Index_, OuterKeyExtractor_, InnerKeyExtractor_, ValueExtractor_> {
+    template <typename Index_, 
+              typename OuterKeyExtractor_, typename InnerKeyExtractor_, typename ValueExtractor_, bool inner_strided_flag = false>
+    class ArrowSequence : 
+      public SifterDef::StridedIndexSequence<Index_, OuterKeyExtractor_, InnerKeyExtractor_, ValueExtractor_, inner_strided_flag> {
       // ArrowSequence extends StridedIndexSequence with extra iterator methods.
     public:
       typedef SifterDef::StridedIndexSequence<Index_, OuterKeyExtractor_, InnerKeyExtractor_, ValueExtractor_> super;
     typedef ArrowSequence<typename ::boost::multi_index::index<rec_set_type, UpwardTag>::type,
                           ALE::member<rec_type, predicate_type, &rec_type::predicate>,
                           ALE::identity<rec_type>,
+                          ALE::member<rec_type, target_type, &rec_type::target>, 
+                          true>                                                       BaseSequence;
+
+    typedef ArrowSequence<typename ::boost::multi_index::index<rec_set_type, UpwardTag>::type,
+                          ALE::member<rec_type, predicate_type, &rec_type::predicate>,
+                          ALE::identity<rec_type>,
                           ALE::member<rec_type, source_type, &rec_type::source> >     ConeSequence;
     //
     // Extended interface

src/docs/website/documentation/installation.html

       </p>
       <font color="#ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 ./config/configure.py --with-cc='win32fe cl' --with-fc='win32fe f90'
---download-f-blas-lapack=1 LIBS="-L/cygdrive/c/Program Files/Microsoft
-Visual Studio/DF98/LIB"</font><br>
+--download-f-blas-lapack=1 LIBS="-L'/cygdrive/c/Program Files/Microsoft
+Visual Studio/DF98/LIB'"</font><br><br>
+Note the usage of both single quotes and double quotes in the above line. <br>
       <p><font color="#551a8b"><b>Configure</b></font><font
  color="#551a8b"><b>:</b> </font>--download-package
 option does not

src/docs/website/documentation/tutorials/index.html

       <td valign="top" width="75%">
       <h3 align="left"><small>These courses introduce the organization
 and use of PETSc for the parallel solution of PDEs</small></h3>
+      <a href="LCRC-06.pdf">Tutorial slides
+from LCRC tutorial Aug, 2006</a>, compatible with version 2.3.1 of PETSc.<br>
+      <br>
+      <a href="ACTS2006/ACTS2006.pdf">Tutorial slides
+from ACTS Aug, 2006</a>, compatible with version 2.3.1 of PETSc.<br>
+      <br>
       <a href="SCAT-Tut06.pdf">Tutorial slides from SCAT 2006</a>
 Workshop at Daresbury Laboratory.<br>
       <br>
-      <p align="left"><a href="ACTS2006/ACTS2006.pdf"><b>Tutorial slides
-from ACTS 2006</b></a>, compatible with version 2.3.1 of PETSc.<br>
-      </p>
       <a href="jhouchins_writeup_revised.pdf">Parallel Implementation
 of Finite Element Code Using PETSc</a>, J. K. Houchins, Clemson
 University, May 2006.<br>
       <br>
       <a href="PetscTu06.pdf">Tutorial slides from SIAM PP 2006</a>&nbsp;
 compatible with version 2.3.1 of PETSc
-      <p align="left"><a href="INL05/tutorial.pdf"><b>Tutorial slides
-from INL</b></a>, compatible with version 2.2.3 of PETSc.<br>
+      <p align="left"><a href="INL05/tutorial.pdf">Tutorial slides
+from INL</a>, compatible with version 2.2.3 of PETSc.<br>
       </p>
-      <p align="left"><a href="Columbia04/DDandMultigrid.pdf"><b>Slides
-on the use of Domain Decomposition and Multigrid</b></a> in PETSc<br>
+      <p align="left"><a href="Columbia04/DDandMultigrid.pdf">Slides
+on the use of Domain Decomposition and Multigrid</a> in PETSc<br>
       </p>
-      <p align="left"><a href="Columbia04/IntroductionToPETSc2.ppt"><b>Tutorial
-slides</b></a>, compatible with version 2.2.1/2.2.2 of PETSc.<br>
+      <p align="left"><a href="Columbia04/IntroductionToPETSc2.ppt">Tutorial
+slides</a>, compatible with version 2.2.1/2.2.2 of PETSc.<br>
       </p>
       <a href="nersc02/nersc02.ppt">Older slides </a>compatiable with
 version 2.1.6 of PETSc

src/mat/impls/aij/seq/aijfact.c

   nlnk = n + 1;
   ierr = PetscLLCreate(n,n,nlnk,lnk,lnkbt);CHKERRQ(ierr);
 
-  ierr = PetscMalloc((n+1)*sizeof(PetscInt)+n*sizeof(PetscInt**),&im);CHKERRQ(ierr);  
-  bi_ptr = (PetscInt**)(im + n);
+  ierr = PetscMalloc2(n+1,PetscInt**,&bi_ptr,n+1,PetscInt,&im);CHKERRQ(ierr);
 
   /* initial FreeSpace size is f*(ai[n]+1) */
   f = info->fill;
   ierr = PetscMalloc((bi[n]+1)*sizeof(PetscInt),&bj);CHKERRQ(ierr);
   ierr = PetscFreeSpaceContiguous(&free_space,bj);CHKERRQ(ierr); 
   ierr = PetscLLDestroy(lnk,lnkbt);CHKERRQ(ierr);
-  ierr = PetscFree(im);CHKERRQ(ierr);
+  ierr = PetscFree2(bi_ptr,im);CHKERRQ(ierr);
 
   /* put together the new matrix */
   ierr = MatCreate(A->comm,B);CHKERRQ(ierr);

src/tops/examples/cxx/ex4/Ex4.sidl

   class System implements-all TOPS.System.Compute.Matrix, 
                               TOPS.System.Initialize.Once, TOPS.System.Compute.RightHandSide, 
                               gov.cca.Component, gov.cca.ports.GoPort  {}
+               
+  class SystemProxy implements-all TOPS.System.Compute.Matrix, 
+                              TOPS.System.Initialize.Once, TOPS.System.Compute.RightHandSide, 
+                              gov.cca.Component {}
 }
 

src/tops/examples/cxx/ex4/run/Ex4_proxy_rc.in

+#!ccaffeine bootstrap file. 
+# ------- don't change anything ABOVE this line.-------------
+path set @PETSC_LIB_DIR@/cca
+
+repository get-global TOPS.UnstructuredSolver
+repository get-global Ex4.System
+repository get-global Ex4.SystemProxy
+
+instantiate TOPS.UnstructuredSolver solver
+instantiate Ex4.System system
+instantiate Ex4.SystemProxy systemProxy
+
+# Connect system provides ports to systemProxy uses ports
+connect systemProxy u_proxy_TOPS.System.Initialize.Once system TOPS.System.Initialize.Once
+connect systemProxy u_proxy_TOPS.System.Compute.Matrix system TOPS.System.Compute.Matrix
+connect systemProxy u_proxy_TOPS.System.Compute.RightHandSide system TOPS.System.Compute.RightHandSide
+
+# Connect solver uses ports to the corresponding system proxy provides ports
+connect solver TOPS.System.Initialize.Once systemProxy TOPS.System.Initialize.Once
+connect solver TOPS.System.Compute.Matrix systemProxy TOPS.System.Compute.Matrix
+connect solver TOPS.System.Compute.RightHandSide systemProxy TOPS.System.Compute.RightHandSide
+
+# Connect system uses ports to the corresponding solver provides ports
+connect system TOPS.Unstructured.Solver solver TOPS.Unstructured.Solver
+
+parameter solver tops_options options "-ksp_monitor"
+
+go system DoSolve
+
+quit

src/tops/examples/cxx/ex4/server/cxx/Ex4_SystemProxy_Impl.cxx

+// 
+// File:          Ex4_SystemProxy_Impl.cxx
+// Symbol:        Ex4.SystemProxy-v0.0.0
+// Symbol Type:   class
+// Babel Version: 1.0.0
+// Description:   Server-side implementation for Ex4.SystemProxy
+// 
+// WARNING: Automatically generated; only changes within splicers preserved
+// 
+// 
+#include "Ex4_SystemProxy_Impl.hxx"
+
+// 
+// Includes for all method dependencies.
+// 
+#ifndef included_TOPS_Matrix_hxx
+#include "TOPS_Matrix.hxx"
+#endif
+#ifndef included_gov_cca_CCAException_hxx
+#include "gov_cca_CCAException.hxx"
+#endif
+#ifndef included_gov_cca_Services_hxx
+#include "gov_cca_Services.hxx"
+#endif
+#ifndef included_sidl_BaseInterface_hxx
+#include "sidl_BaseInterface.hxx"
+#endif
+#ifndef included_sidl_ClassInfo_hxx
+#include "sidl_ClassInfo.hxx"
+#endif
+#ifndef included_sidl_RuntimeException_hxx
+#include "sidl_RuntimeException.hxx"
+#endif
+#ifndef included_sidl_NotImplementedException_hxx
+#include "sidl_NotImplementedException.hxx"
+#endif
+// DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._includes)
+// Insert-Code-Here {Ex4.SystemProxy._includes} (additional includes or code)
+#include <iostream>
+#define MPICH_IGNORE_CXX_SEEK
+#include "mpi.h"
+#include "TOPS.hxx"
+// DO-NOT-DELETE splicer.end(Ex4.SystemProxy._includes)
+
+// speical constructor, used for data wrapping(required).  Do not put code here unless you really know what you're doing!
+Ex4::SystemProxy_impl::SystemProxy_impl() : StubBase(reinterpret_cast< 
+  void*>(::Ex4::SystemProxy::_wrapObj(reinterpret_cast< void*>(this))),false) ,
+  _wrapped(true){ 
+  // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._ctor2)
+  // Insert-Code-Here {Ex4.SystemProxy._ctor2} (ctor2)
+  // DO-NOT-DELETE splicer.end(Ex4.SystemProxy._ctor2)
+}
+
+// user defined constructor
+void Ex4::SystemProxy_impl::_ctor() {
+  // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._ctor)
+  // Insert-Code-Here {Ex4.SystemProxy._ctor} (constructor)
+  // DO-NOT-DELETE splicer.end(Ex4.SystemProxy._ctor)
+}
+
+// user defined destructor
+void Ex4::SystemProxy_impl::_dtor() {
+  // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._dtor)
+  // Insert-Code-Here {Ex4.SystemProxy._dtor} (destructor)
+  // DO-NOT-DELETE splicer.end(Ex4.SystemProxy._dtor)
+}
+
+// static class initializer
+void Ex4::SystemProxy_impl::_load() {
+  // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._load)
+  // Insert-Code-Here {Ex4.SystemProxy._load} (class initialization)
+  // DO-NOT-DELETE splicer.end(Ex4.SystemProxy._load)
+}
+
+// user defined static methods: (none)
+
+// user defined non-static methods:
+/**
+ * Method:  computeMatrix[]
+ */
+void
+Ex4::SystemProxy_impl::computeMatrix_impl (
+  /* in */::TOPS::Matrix J,
+  /* in */::TOPS::Matrix B ) 
+{
+  // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy.computeMatrix)
+  // Insert-Code-Here {Ex4.SystemProxy.computeMatrix} (computeMatrix method)
+#undef __FUNCT__
+#define __FUNCT__ "Ex4::SystemProxy_impl::computeMatrix_impl"
+
+  // This proxy routine simply passes the invocation through to 
+  // the connected System implementation.
+  
+  TOPS::System::Compute::Matrix system;
+  system = ::babel_cast< TOPS::System::Compute::Matrix >(
+    myServices.getPort("u_proxy_TOPS.System.Compute.Matrix"));
+  if (system._is_nil()) {
+    std::cerr << "Error at " << __FILE__ << ":" << __LINE__ 
+          << ": TOPS.System.Compute.Matrix port is nil, " 
+          << "possibly not connected." << std::endl;
+    return;
+  }
+
+  // Use the port
+  system.computeMatrix(J,B);
+  std::cout << "SystemProxy: after call to system.computeMatrix" << std::endl;
+ 
+  myServices.releasePort("TOPS.System.Compute.Matrix");
+  // DO-NOT-DELETE splicer.end(Ex4.SystemProxy.computeMatrix)
+}
+
+/**
+ * Method:  initializeOnce[]
+ */
+void
+Ex4::SystemProxy_impl::initializeOnce_impl () 
+
+{
+  // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy.initializeOnce)
+  // Insert-Code-Here {Ex4.SystemProxy.initializeOnce} (initializeOnce method)
+#undef __FUNCT__
+#define __FUNCT__ "Ex4::SystemProxy_impl::initializeOnce_impl"
+
+  // This proxy routine simply passes the invocation through to 
+  // the connected System implementation.
+  
+  TOPS::System::Initialize::Once system;
+  system = ::babel_cast< TOPS::System::Initialize::Once >(
+    myServices.getPort("u_proxy_TOPS.System.Initialize.Once"));
+  if (system._is_nil()) {
+    std::cerr << "Error at " << __FILE__ << ":" << __LINE__ 
+          << ": TOPS.System.Initialize.Once port is nil, " 
+          << "possibly not connected." << std::endl;
+    return;
+  }
+
+  // Use the port
+  system.initializeOnce();
+  std::cout << "SystemProxy: after call to system.initializeOnce" << std::endl;
+
+  myServices.releasePort("TOPS.System.Initialize.Once");
+  // DO-NOT-DELETE splicer.end(Ex4.SystemProxy.initializeOnce)
+}
+
+/**
+ * Method:  computeRightHandSide[]
+ */
+void
+Ex4::SystemProxy_impl::computeRightHandSide_impl (
+  /* in array<double> */::sidl::array<double> b ) 
+{
+  // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy.computeRightHandSide)
+  // Insert-Code-Here {Ex4.SystemProxy.computeRightHandSide} (computeRightHandSide method)
+#undef __FUNCT__
+#define __FUNCT__ "Ex4::SystemProxy_impl::computeRightHandSide_impl"
+
+  // This proxy routine simply passes the invocation through to 
+  // the connected System implementation.
+  
+  TOPS::System::Compute::RightHandSide system;
+  system = ::babel_cast< TOPS::System::Compute::RightHandSide >(
+    myServices.getPort("u_proxy_TOPS.System.Compute.RightHandSide"));
+  if (system._is_nil()) {
+    std::cerr << "Error at " << __FILE__ << ":" << __LINE__ 
+          << ": TOPS.System.Compute.RightHandSide port is nil, " 
+          << "possibly not connected." << std::endl;
+    return;
+  }
+
+  // Use the port
+  system.computeRightHandSide(b);
+  std::cout << "SystemProxy: after call to system.computeRightHandSide" << std::endl;
+ 
+  myServices.releasePort("TOPS.System.Compute.RightHandSide");
+  // DO-NOT-DELETE splicer.end(Ex4.SystemProxy.computeRightHandSide)
+}
+
+/**
+ *  Starts up a component presence in the calling framework.
+ * @param services the component instance's handle on the framework world.
+ * Contracts concerning Svc and setServices:
+ * 
+ * The component interaction with the CCA framework
+ * and Ports begins on the call to setServices by the framework.
+ * 
+ * This function is called exactly once for each instance created
+ * by the framework.
+ * 
+ * The argument Svc will never be nil/null.
+ * 
+ * Those uses ports which are automatically connected by the framework
+ * (so-called service-ports) may be obtained via getPort during
+ * setServices.
+ */
+void
+Ex4::SystemProxy_impl::setServices_impl (
+  /* in */::gov::cca::Services services ) 
+// throws:
+//     ::gov::cca::CCAException
+//     ::sidl::RuntimeException
+{
+  // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy.setServices)
+  // Insert-Code-Here {Ex4.SystemProxy.setServices} (setServices method)
+#undef __FUNCT__
+#define __FUNCT__ "Ex4::SystemProxy_impl::setServices"
+
+  myServices = services;
+
+  gov::cca::Port p = (*this);      //  Babel required casting
+  if(p._is_nil()) {
+    fprintf(stderr, "Error:: %s:%d: Error casting (*this) to gov::cca::Port \n",
+        __FILE__, __LINE__);
+    return;
+  }
+  
+  // Since this is a System proxy, it defines both uses and provides ports
+  // System and Solver.
+  
+  // Provides ports for System
+  // Initialization
+  myServices.addProvidesPort(p,
+               "TOPS.System.Initialize.Once",
+               "TOPS.System.Initialize.Once", myServices.createTypeMap());
+  // Matrix computation
+  myServices.addProvidesPort(p,
+               "TOPS.System.Compute.Matrix",
+               "TOPS.System.Compute.Matrix", myServices.createTypeMap());
+  
+  // RHS computation
+  myServices.addProvidesPort(p,
+               "TOPS.System.Compute.RightHandSide",
+               "TOPS.System.Compute.RightHandSide", myServices.createTypeMap());
+                   
+  // --------------------------------------------------------------------------
+  // Symmetrical uses/provides ports for proxy
+  // --------------------------------------------------------------------------
+  // Initialization
+  myServices.registerUsesPort("u_proxy_TOPS.System.Initialize.Once",
+               "TOPS.System.Initialize.Once", myServices.createTypeMap());
+               
+  // Matrix computation
+  myServices.registerUsesPort("u_proxy_TOPS.System.Compute.Matrix",
+               "TOPS.System.Compute.Matrix", myServices.createTypeMap());
+  
+  // RHS computation
+  myServices.registerUsesPort("u_proxy_TOPS.System.Compute.RightHandSide",
+               "TOPS.System.Compute.RightHandSide", myServices.createTypeMap());
+ 
+
+  // DO-NOT-DELETE splicer.end(Ex4.SystemProxy.setServices)
+}
+
+
+// DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._misc)
+// Insert-Code-Here {Ex4.SystemProxy._misc} (miscellaneous code)
+// DO-NOT-DELETE splicer.end(Ex4.SystemProxy._misc)
+

src/tops/examples/cxx/ex4/server/cxx/Ex4_SystemProxy_Impl.hxx

+// 
+// File:          Ex4_SystemProxy_Impl.hxx
+// Symbol:        Ex4.SystemProxy-v0.0.0
+// Symbol Type:   class
+// Babel Version: 1.0.0
+// Description:   Server-side implementation for Ex4.SystemProxy
+// 
+// WARNING: Automatically generated; only changes within splicers preserved
+// 
+// 
+
+#ifndef included_Ex4_SystemProxy_Impl_hxx
+#define included_Ex4_SystemProxy_Impl_hxx
+
+#ifndef included_sidl_cxx_hxx
+#include "sidl_cxx.hxx"
+#endif
+#ifndef included_Ex4_SystemProxy_IOR_h
+#include "Ex4_SystemProxy_IOR.h"
+#endif
+#ifndef included_Ex4_SystemProxy_hxx
+#include "Ex4_SystemProxy.hxx"
+#endif
+#ifndef included_TOPS_Matrix_hxx
+#include "TOPS_Matrix.hxx"
+#endif
+#ifndef included_TOPS_System_Compute_Matrix_hxx
+#include "TOPS_System_Compute_Matrix.hxx"
+#endif
+#ifndef included_TOPS_System_Compute_RightHandSide_hxx
+#include "TOPS_System_Compute_RightHandSide.hxx"
+#endif
+#ifndef included_TOPS_System_Initialize_Once_hxx
+#include "TOPS_System_Initialize_Once.hxx"
+#endif
+#ifndef included_gov_cca_CCAException_hxx
+#include "gov_cca_CCAException.hxx"
+#endif
+#ifndef included_gov_cca_Component_hxx
+#include "gov_cca_Component.hxx"
+#endif
+#ifndef included_gov_cca_Services_hxx
+#include "gov_cca_Services.hxx"
+#endif
+#ifndef included_sidl_BaseClass_hxx
+#include "sidl_BaseClass.hxx"
+#endif
+#ifndef included_sidl_BaseInterface_hxx
+#include "sidl_BaseInterface.hxx"
+#endif
+#ifndef included_sidl_ClassInfo_hxx
+#include "sidl_ClassInfo.hxx"
+#endif
+#ifndef included_sidl_RuntimeException_hxx
+#include "sidl_RuntimeException.hxx"
+#endif
+
+
+// DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._includes)
+// Insert-Code-Here {Ex4.SystemProxy._includes} (includes or arbitrary code)
+// DO-NOT-DELETE splicer.end(Ex4.SystemProxy._includes)
+
+namespace Ex4 { 
+
+  /**
+   * Symbol "Ex4.SystemProxy" (version 0.0.0)
+   */
+  class SystemProxy_impl : public virtual ::Ex4::SystemProxy 
+  // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._inherits)
+  // Insert-Code-Here {Ex4.SystemProxy._inherits} (optional inheritance here)
+  // DO-NOT-DELETE splicer.end(Ex4.SystemProxy._inherits)
+  {
+
+  // All data marked protected will be accessable by 
+  // descendant Impl classes
+  protected:
+
+    bool _wrapped;
+
+    // DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._implementation)
+    // Insert-Code-Here {Ex4.SystemProxy._implementation} (additional details)
+    ::gov::cca::Services         myServices;
+    // DO-NOT-DELETE splicer.end(Ex4.SystemProxy._implementation)
+
+  public:
+    // default constructor, used for data wrapping(required)
+    SystemProxy_impl();
+    // sidl constructor (required)
+    // Note: alternate Skel constructor doesn't call addref()
+    // (fixes bug #275)
+    SystemProxy_impl( struct Ex4_SystemProxy__object * s ) : StubBase(s,true),
+      _wrapped(false) { _ctor(); }
+
+    // user defined construction
+    void _ctor();
+
+    // virtual destructor (required)
+    virtual ~SystemProxy_impl() { _dtor(); }
+
+    // user defined destruction
+    void _dtor();
+
+    // true if this object was created by a user newing the impl
+    inline bool _isWrapped() {return _wrapped;}
+
+    // static class initializer
+    static void _load();
+
+  public:
+
+    /**
+     * user defined non-static method.
+     */
+    void
+    computeMatrix_impl (
+      /* in */::TOPS::Matrix J,
+      /* in */::TOPS::Matrix B
+    )
+    ;
+
+    /**
+     * user defined non-static method.
+     */
+    void
+    initializeOnce_impl() ;
+    /**
+     * user defined non-static method.
+     */
+    void
+    computeRightHandSide_impl (
+      /* in array<double> */::sidl::array<double> b
+    )
+    ;
+
+
+    /**
+     *  Starts up a component presence in the calling framework.
+     * @param services the component instance's handle on the framework world.
+     * Contracts concerning Svc and setServices:
+     * 
+     * The component interaction with the CCA framework
+     * and Ports begins on the call to setServices by the framework.
+     * 
+     * This function is called exactly once for each instance created
+     * by the framework.
+     * 
+     * The argument Svc will never be nil/null.
+     * 
+     * Those uses ports which are automatically connected by the framework
+     * (so-called service-ports) may be obtained via getPort during
+     * setServices.
+     */
+    void
+    setServices_impl (
+      /* in */::gov::cca::Services services
+    )
+    // throws:
+    //     ::gov::cca::CCAException
+    //     ::sidl::RuntimeException
+    ;
+
+  };  // end class SystemProxy_impl
+
+} // end namespace Ex4
+
+// DO-NOT-DELETE splicer.begin(Ex4.SystemProxy._misc)
+// Insert-Code-Here {Ex4.SystemProxy._misc} (miscellaneous things)
+// DO-NOT-DELETE splicer.end(Ex4.SystemProxy._misc)
+
+#endif

src/tops/makefile.rules

 	@echo $(SIDL_PACKAGES_TARGETS)
 
 #-------------------------------------------------------------------------------
+# Server build
+
 server-cxx:  server/cxx/obj/makefile 
 	-@cd server/cxx/obj; make TLIBNAME=${TLIBNAME} libserver-cxx.${SOSUFFIX}
 
 		${SIDLEXCLUDE} --server=cxx --output-directory=./server/cxx ${SIDLFILES}
 	@-${RM} ${REMOVEFILES} server/cxx/obj/makefile
 	@-if [ ! -z "${TOPSCLIENT_LIB}" ]; then echo "TOPSCLIENT_LIB = ${TOPSCLIENT_LIB}" > server/cxx/obj/makefile; fi
+	@-if [ ! -f "../babel.make" ]; then echo "include ../babel.make" >> server/cxx/obj/makefile; fi
 	@-echo "include ${PETSC_DIR}/src/tops/makefile.rules" >> server/cxx/obj/makefile
 
 libserver-cxx.${SOSUFFIX}: 
 
 cca: 
 	-@echo "Generating *.cca files for ${EXNAME}"
-	-@${PETSC_DIR}/src/tops/utils/genSCLCCA.sh cca ${PETSC_LIB_DIR}/lib${EXNAME}.${SL_LINKER_SUFFIX} \
-		${EXNAME}.System cxx dynamic global now ${EXNAME}.System > lib${EXNAME}.${SL_LINKER_SUFFIX}.cca.in
+	-@if [ "`grep SystemProxy ${EXNAME}.sidl | wc -l`" == "1" ]; then \
+	     ${PETSC_DIR}/src/tops/utils/genSCLCCAmulti.sh cca ${PETSC_LIB_DIR}/lib${EXNAME}.${SL_LINKER_SUFFIX} \
+		${EXNAME}.System cxx dynamic global now ${EXNAME}.System ${EXNAME}.SystemProxy > lib${EXNAME}.${SL_LINKER_SUFFIX}.cca.in; \
+	else \
+	     ${PETSC_DIR}/src/tops/utils/genSCLCCA.sh cca ${PETSC_LIB_DIR}/lib${EXNAME}.${SL_LINKER_SUFFIX} \
+		${EXNAME}.System cxx dynamic global now ${EXNAME}.System > lib${EXNAME}.${SL_LINKER_SUFFIX}.cca.in; \
+ 	fi
 	-@if [ ! -d "${PETSC_LIB_DIR}/cca" ]; then mkdir ${PETSC_LIB_DIR}/cca; fi
 	-@sed -e /"@PETSC_LIB_DIR@/ s|@PETSC_LIB_DIR@|${PETSC_LIB_DIR}|" \
 	    	-e /"@SOSUFFIX@/ s|@SOSUFFIX@|${SL_LINKER_SUFFIX}|" \
 	-@echo "Creating simple Ccaffeine script"
 	@-cd run; \
 	if [ -f ${EXNAME}_rc.in ]; then\
-	  sed -e /"@PETSC_LIB_DIR@/ s|@PETSC_LIB_DIR@|${PETSC_LIB_DIR}|" ${EXNAME}_rc.in > ${EXNAME}_rc ; fi
-	@-if [ -f ${EXNAME}_gui_rc.in ]; then\
+	  sed -e /"@PETSC_LIB_DIR@/ s|@PETSC_LIB_DIR@|${PETSC_LIB_DIR}|" ${EXNAME}_rc.in > ${EXNAME}_rc ; fi; \
+	if [ -f ${EXNAME}_proxy_rc.in ]; then\
+	  sed -e /"@PETSC_LIB_DIR@/ s|@PETSC_LIB_DIR@|${PETSC_LIB_DIR}|" ${EXNAME}_proxy_rc.in > ${EXNAME}_proxy_rc ; fi ;\
+	if [ -f ${EXNAME}_gui_rc.in ]; then\
 	  sed -e /"@PETSC_LIB_DIR@/ s|@PETSC_LIB_DIR@|${PETSC_LIB_DIR}|" ${EXNAME}_gui_rc.in > ${EXNAME}_gui_rc; fi
 
 test-cca: cca
 	  cd run; \
 	  ${CCAFE_HOME}/bin/ccafe-single --ccafe-rc ${EXNAME}_rc > ${EXNAME}_rc.log  2>&1 ; \
 	  if [ "`egrep \"(specific|1 .+norm)\" ${EXNAME}_rc.log | wc -l`" -ge "2" ]; then \
-	    echo "=== ${EXNAME}: Component test succeeded (see `pwd`/run/${EXNAME}_rc.log)."; \
-	  else echo "*** ${EXNAME}: Component test failed (see `pwd`/run/${EXNAME}_rc.log)."; fi; \
+	    echo "=== ${EXNAME}: Component test succeeded (see `pwd`/${EXNAME}_rc.log)."; \
+	  else echo "*** ${EXNAME}: Component test failed (see `pwd`/${EXNAME}_rc.log)."; fi; \
         else \
 	  cd run; \
-          mpirun -np 1 ${CCAFE_HOME}/bin/ccafe-batch --ccafe-rc `pwd`/${EXNAME}_rc > `pwd`/${EXNAME}_rc.log  2>&1 ; \
+          mpirun -np 2 ${CCAFE_HOME}/bin/ccafe-batch --ccafe-rc `pwd`/${EXNAME}_rc > `pwd`/${EXNAME}_rc.log  2>&1 ; \
 	  if [ "`egrep \"(1 .+norm)\" ${EXNAME}_rc.log | wc -l`" -ge "1" ]; then \
-	    echo "=== ${EXNAME}: Component test succeeded (see `pwd`/run/${EXNAME}_rc.log)."; \
-	  else echo "*** ${EXNAME}: Component test failed (see `pwd`/run/${EXNAME}_rc.log)."; fi; \
+	    echo "=== ${EXNAME}: Component test succeeded (see `pwd`/${EXNAME}_rc.log)."; \
+	  else echo "*** ${EXNAME}: Component test failed (see `pwd`/${EXNAME}_rc.log)."; fi; \
 	fi
 
 gui-cca: cca

src/tops/server/cxx/TOPS_StructuredSolver_Impl.cxx

   params = ::babel_cast< gov::cca::ports::ParameterPort >( myServices.getPort("tops_options") );
   std::string options = params.readConfigurationMap().getString("options","-help");
   processTOPSOptions(options);
+  SNES snes = DMMGGetSNES(dmmg);
+  if (snes) SNESSetFromOptions(snes);
   return true;
   // DO-NOT-DELETE splicer.end(TOPS.StructuredSolver.updateParameterPort)
 }
   // DO-NOT-DELETE splicer.begin(TOPS.StructuredSolver.updatedParameterValue)
   // Insert-Code-Here {TOPS.StructuredSolver.updatedParameterValue} (updatedParameterValue method)
   std::cout << "TOPS::StructuredSolver_impl::updatedParameterValue called" << std::endl;
-  /*
-  int ierr = PetscInitializeVoid();
-  params = myServices.getPort("tops_options");
+  PetscTruth flg;
+  PetscInt ierr;
+  ierr = PetscInitialized(&flg); 
+  if (!flg) ierr = PetscInitializeNoArguments();
+  params = ::babel_cast< gov::cca::ports::ParameterPort >( myServices.getPort("tops_options") );
   std::string options = params.readConfigurationMap().getString("options","-help");
   processTOPSOptions(options);
-  */
+  SNES snes = DMMGGetSNES(dmmg);
+  if (snes)  SNESSetFromOptions(snes);
   // DO-NOT-DELETE splicer.end(TOPS.StructuredSolver.updatedParameterValue)
 }
 

src/tops/utils/genSCLCCAmulti.sh

+#!/bin/sh
+function usage () {
+ 	echo "$0: usage: <mode> <libpath> <language> [dynamic <scope> <resolution>] <babelComponentName space separated list>" > /dev/stderr
+	echo "This script generates to stdout .scl or .cca files which are installed next to the" > /dev/stderr
+	echo "library in the same directory under some name xxxxxx.depl.cca. or libpath.scl." > /dev/stderr
+	echo "The script creates scl and cca info in cca mode or just babel info in scl mode." > /dev/stderr
+	echo " Arguments: mode is cca or scl." > /dev/stderr
+	echo "            libpath is the full path of the .la, .o, .so, or .a file" > /dev/stderr
+	echo "            language is the implementation language (c c++ f77 f90 python)" > /dev/stderr
+	echo "            babelComponentName is a space separated list of the full dot-qualified" > /dev/stderr
+        echo "                           babel.class.name of the component. The class implementing" > /dev/stderr
+        echo "                           gov.cca.Component should appear first for CCA files." > /dev/stderr
+	echo " Optional arguments (if library is dynamically loadable)" > /dev/stderr
+	echo "            dynamic -- required literal. just put it there." > /dev/stderr
+	echo "            scope is global or private" > /dev/stderr
+	echo "            resolution is now or lazy" > /dev/stderr
+	echo " If optional arguments are not given, static is assumed." > /dev/stderr
+	echo "e.g.: $0 scl /somewhere/lib/libComponent3.a Comp3 c++ test3.Component1" > /dev/stderr
+	echo "e.g.: $0 cca /somewhere/lib/libComponent2.so Comp2 python dynamic global lazy test2.Component1" > /dev/stderr
+	echo "e.g.: $0 scl /somewhere/lib/libComponent1.la Comp1 c dynamic private now test1.Component1" > /dev/stderr
+	echo "e.g.: $0 cca /somewhere/lib/libComponent0.la test0.Component1 f77 test0.Component1" > /dev/stderr
+}
+if test $# -lt 5; then
+	usage
+	exit 1;
+fi
+execstring="$0 $*"
+dstring=`date`
+pstring=`pwd`/
+mode=$1
+libpath=$2
+language=$4
+classes=""
+dynamic="static"
+scope="global"
+resolution="now"
+shift 4
+if test $# -ge 1 && test "dynamic" = "$1"; then
+   dynamic="dynamic"
+   shift
+   if test $# -ge 1 && test $1 = "global" -o $1 = "private"; then
+     scope=$1
+     shift
+     if test $# -ge 1 && test $1 = "now" -o $1 = "lazy"; then
+       resolution=$1
+       shift
+     fi
+   fi
+fi
+while test $# -ge 1; do
+  classes="$classes $1"
+  shift
+done
+#echo $mode
+#echo $libpath
+#echo $className
+#echo $language
+#echo $dynamic
+#echo $scope
+#echo $resolution
+#exit 0
+if [ "$language" == python ] ; then
+  pythonImplLine="<class name=\"$className\" desc=\"python/impl\" />"
+fi;  
+if test "x$mode" = "xscl"; then
+cat << __EOF1
+<?xml version="1.0"?> 
+<!-- # generated scl index. -->
+<!-- date=$dstring -->
+<!-- builder=$USER@$HOST -->
+<!-- $execstring -->
+<scl>
+  <library uri="$libpath" 
+	scope="$scope" 
+	resolution="$resolution" > 
+__EOF1
+for className in $classes; do
+    echo "    <class name=\"$className\" desc=\"ior/impl\" />"
+    if [ "$language" == python ] ; then
+      echo "    <class name=\"$className\" desc=\"python/impl\" />"
+    fi
+done
+cat << __EOF2
+  </library>
+</scl>
+__EOF2
+
+exit 0
+fi
+
+if test "x$mode" = "xcca"; then
+cat << __EOF3
+<?xml version="1.0"?> 
+<libInfo>
+<!-- # generated component index. -->
+<!-- date=$dstring -->
+<!-- builder=$USER@$HOST -->
+<!-- $0 $* -->
+<scl>
+  <library uri="$libpath" 
+	scope="$scope" 
+	resolution="$resolution" > 
+__EOF3
+for className in $classes; do
+    echo "    <class name=\"$className\" desc=\"ior/impl\" />"
+    if [ "$language" == python ] ; then
+      echo "    <class name=\"$className\" desc=\"python/impl\" />"
+    fi
+done
+className=`echo $classes | sed 's/ .*//'`
+cat << __EOF4
+  </library>
+</scl>
+__EOF4
+for className in $classes; do
+echo "<componentDeployment "
+echo "  name=\"$className\" "
+echo "  paletteClassAlias=\"$className\" "
+echo "> "
+echo "    <environment> "
+echo "        <ccaSpec binding=\"babel\" /> "
+echo "        <library loading=\"$dynamic\" />"
+echo "    </environment>"
+echo "</componentDeployment>"
+done
+cat << __EOF5
+</libInfo>
+__EOF5
+exit 0
+fi
+
+echo "$0: Unrecognized mode" > /dev/stderr
+usage
+exit 1