[cig-commits] [commit] master: Add find_postprocessor (c4f5527)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Fri May 23 18:31:35 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/194b6f932f6ee27aea14eb44c36aa5432a9cd235...e2d2428a203331b4832dbc4e5f4d716934c22694
>---------------------------------------------------------------
commit c4f55273309fc34e7d77d1cd47cc923d598b0146
Author: Siqi Zhang <siqi.zhang at mq.edu.au>
Date: Fri May 23 11:36:34 2014 -0500
Add find_postprocessor
>---------------------------------------------------------------
c4f55273309fc34e7d77d1cd47cc923d598b0146
include/aspect/postprocess/interface.h | 33 +++++++++++++++++++++++++++++++++
include/aspect/simulator_access.h | 13 ++++++++++++-
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/include/aspect/postprocess/interface.h b/include/aspect/postprocess/interface.h
index 34199a8..8b5d6ed 100644
--- a/include/aspect/postprocess/interface.h
+++ b/include/aspect/postprocess/interface.h
@@ -200,6 +200,17 @@ namespace aspect
std::list<std::pair<std::string,std::string> >
execute (TableHandler &statistics);
+ /**
+ * Go through the list of all postprocessors that have been selected in
+ * the input file (and are consequently currently active) and see if
+ * one of them has the desired type specified by the template
+ * argument. If so, return a pointer to it. If no postprocessor is
+ * active that matches the given type, return a NULL pointer.
+ */
+ template <typename PostprocessorType>
+ PostprocessorType *
+ find_postprocessor ();
+
/**
* Declare the parameters of all known postprocessors, as well as of
* ones this class has itself.
@@ -313,6 +324,28 @@ namespace aspect
(*p)->load (saved_text);
}
+ /**
+ * Go through the list of all postprocessors that have been selected in
+ * the input file (and are consequently currently active) and see if
+ * one of them has the desired type specified by the template
+ * argument. If so, return a pointer to it. If no postprocessor is
+ * active that matches the given type, return a NULL pointer.
+ */
+
+ template <int dim>
+ template <typename PostprocessorType>
+ inline
+ PostprocessorType *
+ Manager<dim>::find_postprocessor ()
+ {
+ for (typename std::list<std_cxx1x::shared_ptr<Interface<dim> > >::iterator
+ p = postprocessors.begin();
+ p != postprocessors.end(); ++p)
+ if (PostprocessorType x = dynamic_cast<PostprocessorType>(p->get())
+ return x;
+ return 0;
+ }
+
/**
* Given a class name, a name, and a description for the parameter file
diff --git a/include/aspect/simulator_access.h b/include/aspect/simulator_access.h
index 5204aa9..0e683e4 100644
--- a/include/aspect/simulator_access.h
+++ b/include/aspect/simulator_access.h
@@ -427,7 +427,18 @@ namespace aspect
const unsigned int q,
std::vector<double> &composition_values_at_q_point);
- /** @} */
+
+ /**
+ * Find a pointer to a certain postprocessor, if not return a NULL pointer.
+ */
+ template <typename PostprocessorType>
+ inline
+ PostprocessorType *
+ SimulatorAccess<dim>::find_postprocessor ()
+ {
+ return simulator->postprocessors.find_postprocessor<PostprocessorType>();
+ }
+ /** @} */
private:
/**
More information about the CIG-COMMITS
mailing list