LCOV - code coverage report
Current view: top level - geom/cgm - CADeferredAttrib.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 0 3 0.0 %
Date: 2020-06-30 00:58:45 Functions: 0 3 0.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : //- Class:          CADeferredAttrib
       2                 :            : //- Owner:          Tim Tautges
       3                 :            : //- Description:    Cubit attribute for storing attributes that will be used later,
       4                 :            : //-       i.e. for entities which don't yet exist in the model
       5                 :            : //- Checked by:
       6                 :            : //- Version:
       7                 :            : //- 
       8                 :            : //- Deferred attributes are used to store data on one solid model entity
       9                 :            : //- which actually apply to a different entity, one which doesn't exist
      10                 :            : //- in the solid model as stored (usually something like virtual geometry)
      11                 :            : //-
      12                 :            : //- This attribute saves/updates something like this:
      13                 :            : //- 1) Normal attribute (mesh interval, scheme, etc.) updates
      14                 :            : //- 2) Normal attribute writes:
      15                 :            : //-    - creates simple attribute, csa_ptr, and passes to 
      16                 :            : //-      GeometryEntity::append_simple_attrib
      17                 :            : //-    - For virtual entities, this is implemented in 
      18                 :            : //-      VirtualEntity::append_simple_attrib_virt
      19                 :            : //- 3) Inside VE::append_simple_attrib_virt, the simple attribute is combined
      20                 :            : //-    with a uid for the owning ref entity and the two are used to make a
      21                 :            : //-    new *simple* deferred attribute
      22                 :            : //- 4) The simple deferred attribute is put onto the first underlying entity
      23                 :            : //-    using TopologyBridge::append_simple_attrib
      24                 :            : //- 
      25                 :            : //- To restore:
      26                 :            : //- 1) Take dcsa, create CADeferredAttrib from it, and put it on owning entity:
      27                 :            : //-    - CADA stores uid from dcsa
      28                 :            : //-    - Then the dcsa is converted to a csa (CADA stuff removed) and stored 
      29                 :            : //-      in CADA on owning entity
      30                 :            : //- 2) When virtual geometry is created from actuating an attribute, CADA is notified;
      31                 :            : //-    CADA goes through the list of CADA's, looking for any that apply to the
      32                 :            : //-    new entity (based on uid)
      33                 :            : //- 3) If any CADA's are found for the new entity, their csa data are converted to
      34                 :            : //-    a real CA, and that CA is put on the unactuatedCAs list in CADA.
      35                 :            : //- 4) At the end of CubitAttribUser::auto_actuate_cubit_attrib, CADA::cleanup_cadas
      36                 :            : //-    is called, which keeps going through the unactuatedCAs list until nothing
      37                 :            : //-    new happens (no new unactuated cas)
      38                 :            : //-
      39                 :            : 
      40                 :            : #ifndef CA_DEFERRED_ATTRIB_HPP
      41                 :            : #define CA_DEFERRED_ATTRIB_HPP
      42                 :            : 
      43                 :            : #include "CubitAttrib.hpp"
      44                 :            : #include <vector>
      45                 :            : 
      46                 :            : #include "CADefines.hpp"
      47                 :            : 
      48                 :            : class RefEntity;
      49                 :            : class CubitSimpleAttrib;
      50                 :            : 
      51                 :            : class CUBIT_GEOM_EXPORT CADeferredAttrib: public CubitAttrib
      52                 :            : {
      53                 :            : private:
      54                 :            : 
      55                 :            :   int uniqueId;
      56                 :            :     //- the deferred id tag for an entity
      57                 :            : 
      58                 :            :   CubitSimpleAttrib thisCSA;
      59                 :            :     //- the deferred attribute information
      60                 :            : 
      61                 :            :   static std::vector<CADeferredAttrib*> allCADeferredAttribs;
      62                 :            :     //- list of all CADA's; used in actuate_all function
      63                 :            : 
      64                 :            :   static std::vector<CubitAttrib*> unactuatedCAs;
      65                 :            :     //- list of new CubitAttrib's that haven't yet been actuated
      66                 :            : 
      67                 :            :   static CubitStatus cleanup_cadas_private(const CubitBoolean from_constructor,
      68                 :            :                                            const CubitBoolean after_geom_changes);
      69                 :            :     //- moves between the global CADA list and the unactuated list:
      70                 :            :     //- 
      71                 :            :     //- 1. tries to actuate all CADAs on unactuated list
      72                 :            :     //- 2. tries to assign_to_owner all CADAs on global list
      73                 :            : public:
      74                 :            :   virtual ~CADeferredAttrib();
      75                 :            : 
      76                 :            : //  CADeferredAttrib(RefEntity*);
      77                 :            : 
      78                 :            :   CADeferredAttrib(RefEntity*, const CubitSimpleAttrib&);
      79                 :            :     //- make a CADA from a simple attribute
      80                 :            : 
      81                 :            :  CubitStatus actuate();
      82                 :            : 
      83                 :            :   CubitStatus update();
      84                 :            : 
      85                 :            :   CubitStatus reset();
      86                 :            : 
      87                 :            :   CubitSimpleAttrib cubit_simple_attrib();
      88                 :            : 
      89                 :          0 :   int unique_id() { return uniqueId;}
      90                 :            : 
      91                 :            :   void unique_id (int id) {uniqueId = id;}
      92                 :            : private:
      93                 :            : //  CubitSimpleAttrib *this_csa() {return thisCSA;};
      94                 :            : 
      95                 :            :   CubitStatus init_csa(const CubitSimpleAttrib &csa_ptr);
      96                 :            : 
      97                 :          0 :   int int_attrib_type() {return CA_DEFERRED_ATTRIB;};
      98                 :            : 
      99                 :            :   CubitStatus assign_to_owner(CubitAttribUser *owner = NULL);
     100                 :            :     //- looks for an entity with the right uid, assigns itself to
     101                 :            :     //- that entity if found
     102                 :            : 
     103                 :            :   static CubitStatus get_deferred_attribs(const int uid,
     104                 :            :                                           std::vector<CADeferredAttrib*> &cada_list);
     105                 :            :     //- given a uid, return a list of CADAs with corresponding uid
     106                 :            : 
     107                 :            : public:
     108                 :          0 :   static std::vector<CubitAttrib*> get_unactuated_deferred_attribs() { return unactuatedCAs; }
     109                 :            :     //- get all unactuated deferred attribs
     110                 :            : 
     111                 :            :   static CubitStatus cleanup_cadas(const CubitBoolean from_constructor,
     112                 :            :                                    const CubitBoolean after_geom_changes);
     113                 :            :     //- moves between the global CADA list and the unactuated list:
     114                 :            :     //- 
     115                 :            :     //- 1. tries to actuate all CADAs on unactuated list
     116                 :            :     //- 2. tries to assign_to_owner all CADAs on global list
     117                 :            : 
     118                 :            :   static CubitStatus owner_created(RefEntity *new_owner, const int uid);
     119                 :            :     //- for a newly created ref entity, assigns any CADA with the same uid to the
     120                 :            :     //- new entity
     121                 :            : private:
     122                 :            : //  static CubitBoolean is_match(CubitSimpleAttrib *csa_ptr, const int uid);
     123                 :            :     //- returns true if the simple attribute is deferred type and matches
     124                 :            :     //- uid
     125                 :            : 
     126                 :            :   static CubitSimpleAttrib csa_from_dcsa(const CubitSimpleAttrib &csa_ptr,
     127                 :            :                                           const int uid = 0);
     128                 :            :     //- given a deferred csa, convert it to a normal csa by removing
     129                 :            :     //- first type string and first int; if first int doesn't match
     130                 :            :     //- uid passed in, NULL is returned
     131                 :            : 
     132                 :            : public:
     133                 :            :   static CubitBoolean add_unactuated_ca(CubitAttrib *ca_ptr);
     134                 :            :     //- adds an unactuated ca (usually one that didn't actuate because it
     135                 :            :     //- depends on some piece of geometry that doesn't exist yet)
     136                 :            : 
     137                 :            :   static CubitBoolean remove_unactuated_ca(CubitAttrib* ca_ptr);
     138                 :            :     //- If attribute gets destroted before it actuates, remove it
     139                 :            :     //- from the list.
     140                 :            : };
     141                 :            : 
     142                 :            : CubitAttrib* CADeferredAttrib_creator(RefEntity* entity, const CubitSimpleAttrib &p_csa);
     143                 :            : 
     144                 :            : #endif
     145                 :            : 

Generated by: LCOV version 1.11