PageRenderTime 26ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/hpc_kernel_samples/sparse_linear_algebra/casestudies/pagerank-petsc/petsc-2.3.2-p10/src/tops/server/cxx/TOPS_UnstructuredSolver_Impl.cxx

https://gitlab.com/pheinzlr/CodeVault
C++ | 571 lines | 336 code | 82 blank | 153 comment | 20 complexity | cc019bb9e1a0d343a8dd67378de3eb48 MD5 | raw file
  1. //
  2. // File: TOPS_UnstructuredSolver_Impl.cxx
  3. // Symbol: TOPS.UnstructuredSolver-v0.0.0
  4. // Symbol Type: class
  5. // Babel Version: 1.0.0
  6. // Description: Server-side implementation for TOPS.UnstructuredSolver
  7. //
  8. // WARNING: Automatically generated; only changes within splicers preserved
  9. //
  10. //
  11. #include "TOPS_UnstructuredSolver_Impl.hxx"
  12. //
  13. // Includes for all method dependencies.
  14. //
  15. #ifndef included_gov_cca_CCAException_hxx
  16. #include "gov_cca_CCAException.hxx"
  17. #endif
  18. #ifndef included_gov_cca_Services_hxx
  19. #include "gov_cca_Services.hxx"
  20. #endif
  21. #ifndef included_sidl_BaseInterface_hxx
  22. #include "sidl_BaseInterface.hxx"
  23. #endif
  24. #ifndef included_sidl_ClassInfo_hxx
  25. #include "sidl_ClassInfo.hxx"
  26. #endif
  27. #ifndef included_sidl_RuntimeException_hxx
  28. #include "sidl_RuntimeException.hxx"
  29. #endif
  30. #ifndef included_sidl_NotImplementedException_hxx
  31. #include "sidl_NotImplementedException.hxx"
  32. #endif
  33. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver._includes)
  34. #include "TOPS_Unstructured_Matrix_Impl.hxx"
  35. #include <iostream>
  36. #include "TOPS_ParameterHandling.hxx" // not from SIDL
  37. static PetscErrorCode FormFunction(SNES snes,Vec uu,Vec f,void *vdmmg)
  38. {
  39. PetscFunctionBegin;
  40. PetscFunctionReturn(0);
  41. }
  42. static PetscErrorCode FormInitialGuess(DMMG dmmg,Vec f)
  43. {
  44. PetscFunctionBegin;
  45. PetscFunctionReturn(0);
  46. }
  47. static PetscErrorCode FormMatrix(DMMG dmmg,Mat J,Mat B)
  48. {
  49. PetscFunctionBegin;
  50. TOPS::UnstructuredSolver *solver = (TOPS::UnstructuredSolver*) dmmg->user;
  51. TOPS::System::Compute::Matrix system;
  52. TOPS::Unstructured::Matrix matrix1 = TOPS::Unstructured::Matrix::_create();
  53. TOPS::Unstructured::Matrix matrix2 = TOPS::Unstructured::Matrix::_create();
  54. #define GetImpl(A,b) (!(A)b) ? 0 : reinterpret_cast<A ## _impl*>(((A) b)._get_ior()->d_data)
  55. // currently no support for dof > 1
  56. TOPS::Unstructured::Matrix_impl *imatrix1 = GetImpl(TOPS::Unstructured::Matrix,matrix1);
  57. TOPS::Unstructured::Matrix_impl *imatrix2 = GetImpl(TOPS::Unstructured::Matrix,matrix2);
  58. imatrix1->mat = J;
  59. imatrix2->mat = B;
  60. system = ::babel_cast< TOPS::System::Compute::Matrix >(
  61. solver->getServices().getPort("TOPS.System.Compute.Matrix"));
  62. if (system._is_nil()) {
  63. std::cerr << "Error at " << __FILE__ << ":" << __LINE__
  64. << ": TOPS.System.Compute.Matrix port is nil, "
  65. << "possibly not connected." << std::endl;
  66. PetscFunctionReturn(1);
  67. }
  68. // Use the port
  69. CHKMEMQ;
  70. system.computeMatrix(matrix1,matrix2);
  71. CHKMEMQ;
  72. solver->getServices().releasePort("TOPS.System.Compute.Matrix");
  73. MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);
  74. MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);
  75. if (J != B) {
  76. MatAssemblyBegin(J,MAT_FINAL_ASSEMBLY);
  77. MatAssemblyEnd(J,MAT_FINAL_ASSEMBLY);
  78. }
  79. PetscFunctionReturn(0);
  80. }
  81. static PetscErrorCode FormRightHandSide(DMMG dmmg,Vec f)
  82. {
  83. PetscFunctionBegin;
  84. TOPS::UnstructuredSolver *solver = (TOPS::UnstructuredSolver*) dmmg->user;
  85. TOPS::System::Compute::RightHandSide system;
  86. double *uu;
  87. Vec local;
  88. VecGhostGetLocalForm(f,&local);
  89. VecGetArray(local,&uu);
  90. int nlocal;
  91. VecGetLocalSize(local,&nlocal);
  92. sidl::array<double> ua;
  93. int lower[4],upper[4],stride[4];
  94. lower[0] = 0; upper[0] = nlocal-1; stride[0] = 1;
  95. ua.borrow(uu,1,*&lower,*&upper,*&stride);
  96. system = ::babel_cast< TOPS::System::Compute::RightHandSide >(
  97. solver->getServices().getPort("TOPS.System.Compute.RightHandSide") );
  98. if (system._is_nil()) {
  99. std::cerr << "Error at " << __FILE__ << ":" << __LINE__
  100. << ": TOPS.System.Compute.RightHandSide port is nil, "
  101. << "possibly not connected." << std::endl;
  102. PetscFunctionReturn(1);
  103. }
  104. CHKMEMQ;
  105. // Use the port
  106. system.computeRightHandSide(ua);
  107. CHKMEMQ;
  108. solver->getServices().releasePort("TOPS.System.Compute.RightHandSide");
  109. VecRestoreArray(local,0);
  110. VecGhostRestoreLocalForm(f,&local);
  111. VecGhostUpdateBegin(f,ADD_VALUES,SCATTER_REVERSE);
  112. VecGhostUpdateEnd(f,ADD_VALUES,SCATTER_REVERSE);
  113. PetscFunctionReturn(0);
  114. }
  115. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver._includes)
  116. // speical constructor, used for data wrapping(required). Do not put code here unless you really know what you're doing!
  117. TOPS::UnstructuredSolver_impl::UnstructuredSolver_impl() :
  118. StubBase(reinterpret_cast<
  119. void*>(::TOPS::UnstructuredSolver::_wrapObj(reinterpret_cast< void*>(this))),
  120. false) , _wrapped(true){
  121. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver._ctor2)
  122. // Insert-Code-Here {TOPS.UnstructuredSolver._ctor2} (ctor2)
  123. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver._ctor2)
  124. }
  125. // user defined constructor
  126. void TOPS::UnstructuredSolver_impl::_ctor() {
  127. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver._ctor)
  128. this->dmmg = PETSC_NULL;
  129. this->bs = 1;
  130. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver._ctor)
  131. }
  132. // user defined destructor
  133. void TOPS::UnstructuredSolver_impl::_dtor() {
  134. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver._dtor)
  135. if (this->dmmg) {DMMGDestroy(this->dmmg);}
  136. if (this->startedpetsc) {
  137. PetscFinalize();
  138. }
  139. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver._dtor)
  140. }
  141. // static class initializer
  142. void TOPS::UnstructuredSolver_impl::_load() {
  143. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver._load)
  144. // Insert-Code-Here {TOPS.UnstructuredSolver._load} (class initialization)
  145. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver._load)
  146. }
  147. // user defined static methods: (none)
  148. // user defined non-static methods:
  149. /**
  150. * Method: getServices[]
  151. */
  152. ::gov::cca::Services
  153. TOPS::UnstructuredSolver_impl::getServices_impl ()
  154. {
  155. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.getServices)
  156. // Insert-Code-Here {TOPS.UnstructuredSolver.getServices} (getServices method)
  157. #undef __FUNCT__
  158. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::getServices()"
  159. return this->myServices;
  160. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.getServices)
  161. }
  162. /**
  163. * Method: setLocalSize[]
  164. */
  165. void
  166. TOPS::UnstructuredSolver_impl::setLocalSize_impl (
  167. /* in */int32_t m )
  168. {
  169. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.setLocalSize)
  170. this->n = m;
  171. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.setLocalSize)
  172. }
  173. /**
  174. * Method: getLocalSize[]
  175. */
  176. int32_t
  177. TOPS::UnstructuredSolver_impl::getLocalSize_impl ()
  178. {
  179. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.getLocalSize)
  180. #undef __FUNCT__
  181. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::getLocalSize"
  182. return this->n;
  183. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.getLocalSize)
  184. }
  185. /**
  186. * Method: setGhostPoints[]
  187. */
  188. void
  189. TOPS::UnstructuredSolver_impl::setGhostPoints_impl (
  190. /* in array<int> */::sidl::array<int32_t> ghosts )
  191. {
  192. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.setGhostPoints)
  193. #undef __FUNCT__
  194. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::setGhostPoints"
  195. SlicedSetGhosts(this->slice,this->bs,this->n,ghosts.length(0),ghosts.first());
  196. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.setGhostPoints)
  197. }
  198. /**
  199. * Method: getGhostPoints[]
  200. */
  201. ::sidl::array<int32_t>
  202. TOPS::UnstructuredSolver_impl::getGhostPoints_impl ()
  203. {
  204. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.getGhostPoints)
  205. // Insert-Code-Here {TOPS.UnstructuredSolver.getGhostPoints} (getGhostPoints method)
  206. return 0;
  207. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.getGhostPoints)
  208. }
  209. /**
  210. * Method: setPreallocation[]
  211. */
  212. void
  213. TOPS::UnstructuredSolver_impl::setPreallocation_impl (
  214. /* in */int32_t d,
  215. /* in */int32_t od )
  216. {
  217. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.setPreallocation)
  218. #undef __FUNCT__
  219. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::setPreallocation"
  220. SlicedSetPreallocation(this->slice,d,PETSC_NULL,od,PETSC_NULL);
  221. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.setPreallocation)
  222. }
  223. /**
  224. * Method: setPreallocation[s]
  225. */
  226. void
  227. TOPS::UnstructuredSolver_impl::setPreallocation_impl (
  228. /* in array<int> */::sidl::array<int32_t> d,
  229. /* in array<int> */::sidl::array<int32_t> od )
  230. {
  231. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.setPreallocations)
  232. #undef __FUNCT__
  233. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::setPreallocation"
  234. SlicedSetPreallocation(this->slice,0,d.first(),0,od.first());
  235. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.setPreallocations)
  236. }
  237. /**
  238. * Method: Initialize[]
  239. */
  240. void
  241. TOPS::UnstructuredSolver_impl::Initialize_impl (
  242. /* in array<string> */::sidl::array< ::std::string> args )
  243. {
  244. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.Initialize)
  245. #undef __FUNCT__
  246. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::Initialize"
  247. PetscTruth initialized;
  248. PetscInitialized(&initialized);
  249. if (initialized) {
  250. this->startedpetsc = 0;
  251. return;
  252. }
  253. this->startedpetsc = 1;
  254. int argc = args.upper(0) + 1;
  255. char **argv = new char* [argc];
  256. std::string arg;
  257. for(int i = 0; i < argc; i++) {
  258. arg = args[i];
  259. argv[i] = new char [arg.length()+1];
  260. arg.copy(argv[i], arg.length(), 0);
  261. argv[i][arg.length()] = 0;
  262. }
  263. PetscInitialize(&argc,&argv,0,0);
  264. SlicedCreate(PETSC_COMM_WORLD,&this->slice);
  265. // Process runtime parameters
  266. params = ::babel_cast< gov::cca::ports::ParameterPort >( myServices.getPort("tops_options") );
  267. std::string options = params.readConfigurationMap().getString("options","-help");
  268. processTOPSOptions(options);
  269. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.Initialize)
  270. }
  271. /**
  272. * Method: solve[]
  273. */
  274. void
  275. TOPS::UnstructuredSolver_impl::solve_impl ()
  276. {
  277. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.solve)
  278. #undef __FUNCT__
  279. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::solve"
  280. PetscErrorCode ierr;
  281. if (!this->dmmg) {
  282. TOPS::System::Initialize::Once once;
  283. once = ::babel_cast< TOPS::System::Initialize::Once >( myServices.getPort("TOPS.System.Initialize.Once") );
  284. if (once._not_nil()) {
  285. once.initializeOnce();
  286. }
  287. myServices.releasePort("TOPS.System.Initialize.Once");
  288. // create DMMG object
  289. DMMGCreate(PETSC_COMM_WORLD,1,(void*)this,&this->dmmg);
  290. DMMGSetDM(this->dmmg,(DM)this->slice);
  291. TOPS::System::Compute::Residual residual;
  292. residual = ::babel_cast< TOPS::System::Compute::Residual >(
  293. myServices.getPort("TOPS.System.Compute.Residual") );
  294. if (residual._not_nil()) {
  295. ierr = DMMGSetSNES(this->dmmg, FormFunction, 0);
  296. } else {
  297. ierr = DMMGSetKSP(this->dmmg,FormRightHandSide,FormMatrix);
  298. }
  299. myServices.releasePort("TOPS.System.Compute.Residual");
  300. TOPS::System::Compute::InitialGuess guess;
  301. guess = ::babel_cast< TOPS::System::Compute::InitialGuess >(myServices.getPort("TOPS.System.Compute.InitialGuess") );
  302. if (guess._not_nil()) {
  303. ierr = DMMGSetInitialGuess(this->dmmg, FormInitialGuess);
  304. }
  305. }
  306. myServices.releasePort("TOPS.System.Compute.InitialGuess");
  307. TOPS::System::Initialize::EverySolve every;
  308. every = ::babel_cast< TOPS::System::Initialize::EverySolve >( myServices.getPort("TOPS.System.Initialize.EverySolve") );
  309. if (every._not_nil()) {
  310. every.initializeEverySolve();
  311. }
  312. myServices.releasePort("TOPS.System.Initialize.EverySolve");
  313. DMMGSolve(this->dmmg);
  314. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.solve)
  315. }
  316. /**
  317. * Method: setBlockSize[]
  318. */
  319. void
  320. TOPS::UnstructuredSolver_impl::setBlockSize_impl (
  321. /* in */int32_t bs )
  322. {
  323. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.setBlockSize)
  324. #undef __FUNCT__
  325. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::setBlockSize"
  326. this->bs = bs;
  327. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.setBlockSize)
  328. }
  329. /**
  330. * Method: getSolution[]
  331. */
  332. ::sidl::array<double>
  333. TOPS::UnstructuredSolver_impl::getSolution_impl ()
  334. {
  335. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.getSolution)
  336. // Insert-Code-Here {TOPS.UnstructuredSolver.getSolution} (getSolution method)
  337. return 0;
  338. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.getSolution)
  339. }
  340. /**
  341. * Method: setSolution[]
  342. */
  343. void
  344. TOPS::UnstructuredSolver_impl::setSolution_impl (
  345. /* in array<double> */::sidl::array<double> location )
  346. {
  347. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.setSolution)
  348. // Insert-Code-Here {TOPS.UnstructuredSolver.setSolution} (setSolution method)
  349. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.setSolution)
  350. }
  351. /**
  352. * Starts up a component presence in the calling framework.
  353. * @param services the component instance's handle on the framework world.
  354. * Contracts concerning Svc and setServices:
  355. *
  356. * The component interaction with the CCA framework
  357. * and Ports begins on the call to setServices by the framework.
  358. *
  359. * This function is called exactly once for each instance created
  360. * by the framework.
  361. *
  362. * The argument Svc will never be nil/null.
  363. *
  364. * Those uses ports which are automatically connected by the framework
  365. * (so-called service-ports) may be obtained via getPort during
  366. * setServices.
  367. */
  368. void
  369. TOPS::UnstructuredSolver_impl::setServices_impl (
  370. /* in */::gov::cca::Services services )
  371. // throws:
  372. // ::gov::cca::CCAException
  373. // ::sidl::RuntimeException
  374. {
  375. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.setServices)
  376. // Insert-Code-Here {TOPS.UnstructuredSolver.setServices} (setServices method)
  377. #undef __FUNCT__
  378. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::setServices"
  379. myServices = services;
  380. gov::cca::TypeMap tm = services.createTypeMap();
  381. if(tm._is_nil()) {
  382. fprintf(stderr, "Error:: %s:%d: gov::cca::TypeMap is nil\n",
  383. __FILE__, __LINE__);
  384. exit(1);
  385. }
  386. gov::cca::Port p = (*this); // Babel required casting
  387. if(p._is_nil()) {
  388. fprintf(stderr, "Error:: %s:%d: Error casting (*this) to gov::cca::Port \n",
  389. __FILE__, __LINE__);
  390. exit(1);
  391. }
  392. // Provides port
  393. services.addProvidesPort(p,
  394. "TOPS.Unstructured.Solver",
  395. "TOPS.Unstructured.Solver", tm);
  396. // Uses ports
  397. services.registerUsesPort("TOPS.System.Initialize.Once",
  398. "TOPS.System.Initialize.Once", tm);
  399. services.registerUsesPort("TOPS.System.Initialize.EverySolve",
  400. "TOPS.System.Initialize.EverySolve", tm);
  401. services.registerUsesPort("TOPS.System.Compute.InitialGuess",
  402. "TOPS.System.Compute.InitialGuess", tm);
  403. services.registerUsesPort("TOPS.System.Compute.Matrix",
  404. "TOPS.System.Compute.Matrix", tm);
  405. services.registerUsesPort("TOPS.System.Compute.RightHandSide",
  406. "TOPS.System.Compute.RightHandSide", tm);
  407. services.registerUsesPort("TOPS.System.Compute.Jacobian",
  408. "TOPS.System.Compute.Jacobian", tm);
  409. services.registerUsesPort("TOPS.System.Compute.Residual",
  410. "TOPS.System.Compute.Residual", tm);
  411. // Parameter port
  412. myServices.registerUsesPort("ParameterPortFactory",
  413. "gov.cca.ports.ParameterPortFactory", tm);
  414. // Set up parameter port
  415. if (this->setupParameterPort() != 0) {
  416. std::cerr << "TOPS::UnstructuredSolver_impl::go: errors during setup of ParameterPort" << std::endl;
  417. }
  418. myServices.unregisterUsesPort("ParameterPortFactory");
  419. return;
  420. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.setServices)
  421. }
  422. /**
  423. * Inform the listener that someone is about to fetch their
  424. * typemap. The return should be true if the listener
  425. * has changed the ParameterPort definitions.
  426. */
  427. bool
  428. TOPS::UnstructuredSolver_impl::updateParameterPort_impl (
  429. /* in */const ::std::string& portName )
  430. {
  431. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.updateParameterPort)
  432. // Insert-Code-Here {TOPS.UnstructuredSolver.updateParameterPort} (updateParameterPort method)
  433. std::cout << "TOPS::UnstructuredSolver_impl::updatedParameterPort called" << std::endl;
  434. // Get the runtime parameters
  435. params = ::babel_cast< gov::cca::ports::ParameterPort>( myServices.getPort("tops_options") );
  436. std::string options = params.readConfigurationMap().getString("options","-help");
  437. processTOPSOptions(options);
  438. return true;
  439. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.updateParameterPort)
  440. }
  441. /**
  442. * The component wishing to be told after a parameter is changed
  443. * implements this function.
  444. * @param portName the name of the port (typemap) on which the
  445. * value was set.
  446. * @param fieldName the name of the value in the typemap.
  447. */
  448. void
  449. TOPS::UnstructuredSolver_impl::updatedParameterValue_impl (
  450. /* in */const ::std::string& portName,
  451. /* in */const ::std::string& fieldName )
  452. {
  453. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver.updatedParameterValue)
  454. // Insert-Code-Here {TOPS.UnstructuredSolver.updatedParameterValue} (updatedParameterValue method)
  455. std::cout << "TOPS::UnstructuredSolver_impl::updatedParameterValue called" << std::endl;
  456. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver.updatedParameterValue)
  457. }
  458. // DO-NOT-DELETE splicer.begin(TOPS.UnstructuredSolver._misc)
  459. // Insert-Code-Here {TOPS.UnstructuredSolver._misc} (miscellaneous code)
  460. int TOPS::UnstructuredSolver_impl::setupParameterPort() {
  461. #undef __FUNCT__
  462. #define __FUNCT__ "TOPS::UnstructuredSolver_impl::setupParameterPort"
  463. // First, get parameters
  464. ppf = ::babel_cast< gov::cca::ports::ParameterPortFactory>( myServices.getPort("ParameterPortFactory") );
  465. if (ppf._is_nil()) {
  466. std::cerr << "TOPS::UnstructuredSolver_impl::setupParameterPort: called without ParameterPortFactory connected." << std::endl;
  467. return -1;
  468. }
  469. gov::cca::TypeMap tm = myServices.createTypeMap();
  470. if (tm._is_nil()) {
  471. std::cerr << "TOPS::UnstructuredSolver_impl::setupParameterPort: myServices.createTypeMap failed." << std::endl;
  472. return -1;
  473. }
  474. ppf.initParameterData(tm, "tops_options");
  475. ppf.setBatchTitle(tm, "TOPS Options");
  476. ppf.addRequestString(tm, "options", "Space-separated list of TOPS options",
  477. "Enter runtime TOPS options", "-help");
  478. // We may want to respond to changes
  479. gov::cca::ports::ParameterSetListener paramSetListener = (*this);
  480. ppf.registerUpdatedListener(tm, paramSetListener);
  481. // We may want to change the parameters before sharing them
  482. gov::cca::ports::ParameterGetListener paramGetListener = (*this);
  483. ppf.registerUpdater(tm, paramGetListener);
  484. // publish the parameter port and release the parameter port factory
  485. ppf.addParameterPort(tm, myServices);
  486. myServices.releasePort("ParameterPortFactory");
  487. return 0;
  488. }
  489. // DO-NOT-DELETE splicer.end(TOPS.UnstructuredSolver._misc)