36 using namespace common;
37 using namespace common::PE;
49 properties()[
"brief"] = std::string(
"Compute surface-integral of field");
52 "Compute surface integral of a field, given surface regions";
57 .description(
"order of integration")
63 .description(
"Field to integrate")
69 .description(
"Regions to integrate")
70 .pretty_name(
"Regions")
100 std::set< Handle<Entities> > entities_set;
112 std::vector< Handle<Entities> > entities; entities.reserve(entities_set.size());
115 entities.push_back(patch);
122 Real local_integral = 0.;
125 if( patch->element_type().dimensionality() >= patch->element_type().dimension() )
130 m_quadrature = create_component<Quadrature>(
"quadrature",
135 const Uint nb_elems = space.size();
136 const Uint nb_nodes_per_elem = space.shape_function().nb_nodes();
140 RealMatrix qdr_pt_values( nb_qdr_pts, nb_vars );
141 RealMatrix interpolate( nb_qdr_pts, nb_nodes_per_elem );
142 RealMatrix field_pt_values( nb_nodes_per_elem, nb_vars );
145 patch->geometry_space().allocate_coordinates(elem_coords);
147 for(
Uint qn=0; qn<nb_qdr_pts; ++qn)
149 interpolate.row(qn) = space.shape_function().value(
m_quadrature->local_coordinates().row(qn) );
153 for (
Uint e=0;
e<nb_elems; ++
e)
155 if( ! patch->is_ghost(
e) )
157 patch->geometry_space().put_coordinates(elem_coords,
e);
160 for (
Uint n=0;
n<nb_nodes_per_elem; ++
n)
162 const Uint p = space.connectivity()[
e][
n];
165 field_pt_values(
n,
v) = field[
p][
v];
168 qdr_pt_values = interpolate * field_pt_values;
171 for(
Uint qn=0; qn<nb_qdr_pts; ++qn)
173 const Real Jdet = patch->element_type().jacobian_determinant(
m_quadrature->local_coordinates().row(qn), elem_coords );
174 local_integral += Jdet *
m_quadrature->weights()[qn] * qdr_pt_values(qn,0);
179 Real global_integral;
180 PE::Comm::instance().all_reduce(PE::plus(), &local_integral, 1, &global_integral);
181 return global_integral;
191 std::vector< Handle<Region> > regions = options.
value< std::vector<Handle<Region> > >(
"regions");
197 reply_options.
add(
"return_value", integral);
207 .description(
"Field to integrate");
210 .description(
"Regions to integrate");
Abstracts the use of XML when adding options to a signal frame.
std::string name(ComponentWrapper &self)
bool is_null(T ptr)
predicate for comparison to nullptr
Safe pointer to an object. This is the supported method for referring to components.
std::vector< Handle< Region > > m_regions
void signature_integrate(common::SignalArgs &node)
Helper class to create the Builder and place it in the factory.
Signal & description(const std::string &desc)
sets the description of this signal
Real integrate(const Field &field, const std::vector< Handle< Region > > ®ions)
common::ComponentBuilder< SurfaceIntegral, Action, mesh::actions::LibActions > SurfaceIntegral_Builder
Signal & connect(const Signal::slot_type &subscriber)
connects to a subscribing slot
ElementType & element_type() const
return the elementType
URI uri() const
Construct the full path.
#define boost_foreach
lowercase version of BOOST_FOREACH
Handle< Quadrature > m_quadrature
Real e()
Definition of the Unit charge [C].
SignalFrame create_reply(const URI &sender=URI())
Common_API std::string to_str(const T &v)
Converts to std::string.
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic > RealMatrix
Dynamic sized matrix of Real scalars.
Signal & pretty_name(const std::string &name)
sets the pretty name of this signal
Uint dimensionality() const
static Convert & instance()
get the unique instance of the converter class
PropertyList & properties()
Signal & signature(const Signal::slot_type &subscriber)
connects to a subscribing signature
const Handle< Space const > & space(const Handle< Entities const > &entities) const
Top-level namespace for coolfluid.
const TYPE value(const std::string &opt_name) const
Get the value of the option with given name.
void signal_integrate(common::SignalArgs &node)
Uint row_size(Uint i=0) const
SurfaceIntegral(const std::string &name)
constructor
LoadBalance::LoadBalance(const std::string &name) std::string desc
Component that executes an action. Implementation of the IAction interface as a component, exposing the execute function as a signal.
boost::shared_ptr< Component > remove_component(const std::string &name)
Remove a (sub)component of this component.
unsigned int Uint
typedef for unsigned int
virtual void execute()
execute the action
Handle< Component > handle()
Get a handle to the component.
std::string to_str(const EnumType &in)
conversion from enum to string
Signal & regist_signal(const SignalID &sname)
Regist signal.
SelectOptionType< T >::type & add(const std::string &name, const T &default_value=T())
std::string string() const
bool is_not_null(T ptr)
predicate for comparison to nullptr
boost::proto::result_of::make_expr< boost::proto::tag::function, IntegralTag< boost::mpl::int_< Order > >, ExprT const & >::type const integral(ExprT const &expr)