xc
ActionWrapper.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. PĂ©rez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //ActionWrapper.hxx
22 //Representative values of an action.
23 
24 #ifndef ACTIONWRAPPER_H
25 #define ACTIONWRAPPER_H
26 
27 #include <iostream>
28 #include "Action.h"
29 #include "utility/kernel/EntityWithOwner.h"
30 
31 namespace cmb_acc{
32 
33 class PartialSafetyFactors;
34 class ActionWrapperList;
35 class ActionsFamily;
36 class LeadingActionInfo;
37 class Variations;
38 
40 //
43  {
44  protected:
45  friend class ActionWrapperList;
48 
50  ActionWrapper(ActionWrapperList *list= nullptr, const std::string &nmb_partial_safety_factors= "");
51  public:
53  void setPartialSafetyFactors(const std::string &);
54  const ActionsFamily *getFamily(void) const;
55  int getIndex(void) const;
56  virtual std::string getName(void) const= 0;
57  virtual bool notDeterminant(void) const= 0;
58 
59  virtual std::vector<const Action *> getWrappedActions(void) const= 0;
60  virtual const Action *getAction(const size_t &) const= 0;
61  virtual const ActionRelationships &getRelaciones(void) const= 0;
62  virtual bool Incompatible(const ActionWrapper &f) const;
65  inline bool Compatible(const ActionWrapper &aw) const
66  { return !Incompatible(aw); }
67  std::string incompatibleStringList(ActionWrapperList *) const;
68 
69  Action::map_descomp getComponents(void) const;
70  boost::python::dict getComponentsPy(void) const;
71  boost::python::dict getPyDict(void) const;
72  void setPyDict(const boost::python::dict &);
73 
74  Variations getVariations(const bool &,const bool &) const;
75  virtual Action getRepresentativeValue(const LeadingActionInfo &) const= 0;
76  Action getCombinationValue(const LeadingActionInfo &, const double &) const;
77  void Print(std::ostream &os) const;
78  };
79 
80 bool incompatibles(const ActionWrapper &acc_i,const ActionWrapper &acc_j);
81 
84 template <class InputIterator>
85 std::deque<const ActionWrapper *> listaIncompatibles(const ActionWrapper *acc,InputIterator begin,InputIterator end)
86  {
87  std::deque<const ActionWrapper *> retval;
88  for(InputIterator i=begin;i!=end;i++)
89  {
90  const ActionWrapper &data= *(*i).get();
91  if(acc->Incompatible(data)) retval.push_back(&data);
92  }
93  return retval;
94  }
95 
96 std::ostream &operator<<(std::ostream &,const ActionWrapper &);
97 
98 } //fin namespace nmb_acc.
99 
100 #endif
Action::map_descomp getComponents(void) const
When the wrapped actions decomposition.
Definition: ActionWrapper.cc:96
virtual bool Incompatible(const ActionWrapper &f) const
Return true if this actions are not compatible with those in the argument wrapper.
Definition: ActionWrapper.cc:201
void setPartialSafetyFactors(const std::string &)
Set the partial safety factors.
Definition: ActionWrapper.cc:53
List of representative values of actions (ActionWrapper objects).
Definition: ActionWrapperList.h:42
Routines to generate combinations of actions.
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: ActionWrapper.cc:141
boost::python::dict getComponentsPy(void) const
Return the group components in a Python dictionary.
Definition: ActionWrapper.cc:110
const PartialSafetyFactors * getPartialSafetyFactors(void) const
Return the partial safety factors.
Definition: ActionWrapper.cc:42
Action getCombinationValue(const LeadingActionInfo &, const double &) const
Return the combination value for the action.
Definition: ActionWrapper.cc:173
Entity with a pointer to its owner.
Definition: EntityWithOwner.h:34
Conjunto de las posibles variations de dos elementos (partial_safety_factors_fav y partial_safety_fac...
Definition: Variations.h:35
ActionWrapperList * container
Container for the actions of the family.
Definition: ActionWrapper.h:46
bool incompatibles(const Action &acc_i, const Action &acc_j)
Return true if actions are incompatible.
Definition: Action.cc:285
int getIndex(void) const
Return the index of the action in its container.
Definition: ActionWrapper.cc:79
ActionWrapper(ActionWrapperList *list=nullptr, const std::string &nmb_partial_safety_factors="")
Default constructor.
Definition: ActionWrapper.cc:33
Action or linear combination of actions.
Definition: Action.h:44
Variations getVariations(const bool &, const bool &) const
Compute the variations that can be formed with this action.
Definition: ActionWrapper.cc:164
Information about the leading action.
Definition: LeadingActionInfo.h:35
const PartialSafetyFactors * partial_safety_factors
Partial safety factors for the actions in this wrapper.
Definition: ActionWrapper.h:47
std::deque< const ActionWrapper * > listaIncompatibles(const ActionWrapper *acc, InputIterator begin, InputIterator end)
Return the list of actions wrappers incompatibles with the one being passed as parameter.
Definition: ActionWrapper.h:85
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: ActionWrapper.cc:124
Partial safety factors de una familia de acciones en SLS y ULS.
Definition: PartialSafetyFactors.h:98
const ActionsFamily * getFamily(void) const
Return the family that owns this object.
Definition: ActionWrapper.cc:87
Base class for action design values and action groups.
Definition: ActionWrapper.h:42
Relationship of an action with the other ones.
Definition: ActionRelationships.h:37
bool Compatible(const ActionWrapper &aw) const
Return true if this actions is compatible with the argument one.
Definition: ActionWrapper.h:65
Family of actions (permanent, variable, accidental,...)
Definition: ActionsFamily.h:44
void Print(std::ostream &os) const
Print stuff.
Definition: ActionWrapper.cc:179