7 #include <boost/bind.hpp>
8 #include <boost/function.hpp>
43 using namespace solver::actions::Proto;
49 m_changing_result(false)
52 .pretty_name(
"History")
53 .description(
"History component used to log the history of the integral value.")
59 .
description(
"Set up the model using a specific solver" )
70 using boost::proto::lit;
72 const Uint dim = physical_model().ndim();
76 typedef boost::mpl::vector6<mesh::LagrangeP1::Line2D, mesh::LagrangeP1::Quad3D, mesh::LagrangeP1::Triag3D, mesh::LagrangeP0::Line, mesh::LagrangeP0::Quad, mesh::LagrangeP0::Triag> element_types;
87 options().
add(
"result", std::vector<Real>(dim)).pretty_name(
"Result").description(
"Result of the last integral computation").mark_basic().attach_trigger(boost::bind(&
SurfaceIntegral::trigger_result,
this));
117 set_field(options.
value<std::string>(
"variable_name"), options.
value<std::string>(
"field_tag"));
124 options.
add(
"variable_name",
"SomeScalar")
125 .pretty_name(
"Variable Name")
126 .description(
"Name of the variable to use");
128 options.
add(
"field_tag",
"SomeFieldTag")
129 .pretty_name(
"Field Tag")
130 .description(
"Tag for the field to use");
137 if(m_loop_regions.empty())
143 mesh::Mesh&
mesh = common::find_parent_component<mesh::Mesh>(*m_loop_regions.front());
145 const std::string elems_name =
"cf3.mesh.LagrangeP0";
148 if(!elems_P0.has_tag(
"ufem_dict"))
149 elems_P0.add_tag(
"ufem_dict");
154 is_local_element = elems_P0.create_field(
"surface_integrator",
"is_local_element").handle<
mesh::Field>();
155 is_local_element->
add_tag(
"surface_integrator");
157 if(!is_local_element->has_tag(
"local_element_initialized"))
159 const Uint nb_elems = is_local_element->size();
160 for(
Uint i = 0; i != nb_elems; ++i)
162 is_local_element->array()[i][0] = !elems_P0.is_ghost(i);
170 std::vector<Real> local_v(dim);
171 for(
Uint i = 0; i != dim; ++i)
173 std::vector<Real> global_v(local_v.begin(), local_v.end());
T * all_reduce(const Op &op, const T *in_values, const int in_n, T *out_values, const int stride=1)
Abstracts the use of XML when adding options to a signal frame.
std::string name(ComponentWrapper &self)
boost::proto::terminal< SFOp< NormalOp > >::type const normal
bool is_null(T ptr)
predicate for comparison to nullptr
Safe pointer to an object. This is the supported method for referring to components.
Dictionary & create_discontinuous_space(const std::string &space_name, const std::string &space_lib_name, const std::vector< Handle< Entities > > &entities)
Helper class to create the Builder and place it in the factory.
void set_expression(const boost::shared_ptr< Expression > &expression)
void erase(const std::string &name)
This header collects all the headers needed for the linear system solver, also including configure-ti...
Signal & description(const std::string &desc)
sets the description of this signal
Class to encapsulate Proto actions.
Signal & connect(const Signal::slot_type &subscriber)
connects to a subscribing slot
boost::shared_ptr< ElementsExpression< ExprT, ElementTypes > > elements_expression(ElementTypes, const ExprT &expr)
Dimensionalities::Type dimensionality(const std::string &name) const
Common_API std::string to_str(const T &v)
Converts to std::string.
void signal_set_field(common::SignalArgs &args)
common::ComponentBuilder< SurfaceIntegral, common::Action, LibUFEM > SurfaceIntegral_Builder
virtual ~SurfaceIntegral()
Signal & pretty_name(const std::string &name)
sets the pretty name of this signal
SurfaceIntegral(const std::string &name)
void set_field(const std::string &variable_name, const std::string &tag)
Set up the field to use. This builds either a vector or a scalar expression, depending on the variabl...
void signature_set_field(common::SignalArgs &args)
Signal & signature(const Signal::slot_type &subscriber)
connects to a subscribing signature
void trigger_result()
Trigger on a change of the result.
Handle< Component > get_child(const std::string &name)
Top-level namespace for coolfluid.
const TYPE value(const std::string &opt_name) const
Get the value of the option with given name.
virtual void execute()
execute the action
void add_tag(const std::string &tag)
static Convert & instance()
get the unique instance of the converter class
std::string m_variable_name
Name of the variable to use.
static std::string library_namespace()
unsigned int Uint
typedef for unsigned int
Handle< solver::History > m_history
RealVector m_integral_value
Storage for the value of the surface integral.
Signal & regist_signal(const SignalID &sname)
Regist signal.
SelectOptionType< T >::type & add(const std::string &name, const T &default_value=T())
static Comm & instance()
Return a reference to the current PE.
virtual void execute()
execute the action
void set(const std::string &pname, const boost::any &val)
bool is_not_null(T ptr)
predicate for comparison to nullptr