1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//- Class:          CubitAttrib
//- Owner:          Greg Nielson
//- Description:    implementation of the CubitAttrib class.
//- Checked By:
//- Version:

#include "CastTo.hpp"
#include "CubitAttrib.hpp"
#include "CubitAttribUser.hpp"
#include "Body.hpp"
#include "RefVolume.hpp"
#include "RefFace.hpp"
#include "RefEdge.hpp"
#include "RefVertex.hpp"
#include "CADeferredAttrib.hpp"
#include "RefEntity.hpp"
#include "DLIList.hpp"
#include "RefEntityFactory.hpp"
#include "MergeTool.hpp"
#include "ModelQueryEngine.hpp"
#include "GeometryQueryTool.hpp"




CubitAttrib::CubitAttrib(RefEntity *attrib_owner)
{
  attribOwnerEntity = attrib_owner;
  hasActuated = CUBIT_FALSE;
  hasUpdated = CUBIT_FALSE;
  hasWritten = CUBIT_FALSE;
  deleteAttrib = CUBIT_FALSE;
  nextAttrib = NULL;

    // add this to the owner
  if (attrib_owner) attrib_owner->add_cubit_attrib(this);
}

CubitAttrib::~CubitAttrib()
{
  if( !hasActuated )
    CADeferredAttrib::remove_unactuated_ca( this );
}

CubitStatus CubitAttrib::actuate_list(DLIList<RefEntity*> entity_list)
{
  RefEntity * ref_ent;
  for(int i = entity_list.size(); i > 0; i--)
  {
    ref_ent = entity_list.get_and_step();
    ref_ent->actuate_cubit_attrib(CA_ENTITY_NAME);
    ref_ent->actuate_cubit_attrib ( CA_UNIQUE_ID );
    ref_ent->actuate_cubit_attrib(CA_SIZING_FUNCTION_SKELETON);
    ref_ent->actuate_cubit_attrib(CA_MESH_INTERVAL);
    ref_ent->actuate_cubit_attrib(CA_GROUP);
    ref_ent->actuate_cubit_attrib(CA_GENESIS_ENTITY);
//    ref_ent->actuate_cubit_attrib ( CA_ENTITY_ID );
    ref_ent->actuate_cubit_attrib ( CA_MESH_SCHEME );
    ref_ent->actuate_cubit_attrib ( CA_SMOOTH_SCHEME );
    ref_ent->actuate_cubit_attrib ( CA_PARTITION_VG );
    ref_ent->actuate_cubit_attrib ( CA_COMPOSITE_VG );
    ref_ent->actuate_cubit_attrib ( CA_VIRTUAL_VG );
    ref_ent->actuate_cubit_attrib(CA_MERGE_PARTNER);
    ref_ent->actuate_cubit_attrib(CA_DEFERRED_ATTRIB);
    ref_ent->actuate_cubit_attrib(CA_MESH_CONTAINER);
    ref_ent->actuate_cubit_attrib(CA_BODIES);
    ref_ent->actuate_cubit_attrib ( CA_ENTITY_ID );
    ref_ent->actuate_cubit_attrib(CA_ENTITY_COLOR);
    ref_ent->actuate_cubit_attrib(CA_ENTITY_TOL);
//#ifdef CAT
    ref_ent->actuate_cubit_attrib(CA_VERTEX_FORCE);
    ref_ent->actuate_cubit_attrib(CA_SURFACE_FORCE);
    ref_ent->actuate_cubit_attrib(CA_CURVE_FORCE);
    ref_ent->actuate_cubit_attrib(CA_VERTEX_DISPLACEMENT);
    ref_ent->actuate_cubit_attrib(CA_SURFACE_DISPLACEMENT);
    ref_ent->actuate_cubit_attrib(CA_CURVE_DISPLACEMENT);
    ref_ent->actuate_cubit_attrib(CA_VOLUME_DISPLACEMENT);
    ref_ent->actuate_cubit_attrib(CA_SURFACE_PRESSURE);
    ref_ent->actuate_cubit_attrib(CA_CURVE_PRESSURE);
    ref_ent->actuate_cubit_attrib(CA_SURFACE_TEMPERATURE);
    ref_ent->actuate_cubit_attrib(CA_CURVE_TEMPERATURE);
    ref_ent->actuate_cubit_attrib(CA_VERTEX_TEMPERATURE);
    ref_ent->actuate_cubit_attrib(CA_SURFACE_HEATFLUX);
    ref_ent->actuate_cubit_attrib(CA_CURVE_HEATFLUX);
    ref_ent->actuate_cubit_attrib(CA_SURFACE_CONVECTION);
    ref_ent->actuate_cubit_attrib(CA_CURVE_CONVECTION);
    ref_ent->actuate_cubit_attrib(CA_SURFACE_CONTACT);
    ref_ent->actuate_cubit_attrib(CA_CURVE_CONTACT);
    ref_ent->actuate_cubit_attrib(CA_COORD_SYS);
    ref_ent->actuate_cubit_attrib(CA_PROPERTY_BLOCK);
    ref_ent->actuate_cubit_attrib(CA_MATERIAL_BLOCK);
//#endif
    ref_ent->actuate_cubit_attrib(CA_MERGE_STATUS);
  }
  return CUBIT_SUCCESS;
}

void CubitAttrib::has_written(CubitBoolean set_has_written)
{
  hasWritten = set_has_written;

    // if the written flag is being set to true, reset the hasUpdated flag
  if (CUBIT_TRUE == hasWritten)
    hasUpdated = CUBIT_FALSE;
}

CubitBoolean CubitAttrib::has_written() const
{return hasWritten;}

void CubitAttrib::remove_attribute()
{
  if (has_written())
    attribOwnerEntity->remove_attrib_geometry_entity(this);
}

void CubitAttrib::add_attribute()
{
  attribOwnerEntity->add_cubit_attrib(this);
}

int CubitAttrib::equivalent(const CubitSimpleAttrib& csa_ptr)
{
    //- return true if the csa and this are equivalent
   CubitSimpleAttrib this_csa_ptr = cubit_simple_attrib();

   return this_csa_ptr == csa_ptr;
}

void CubitAttrib::print()
{
    // print some details about this attrib
  PRINT_INFO("Attrib type %s, Owner = %s %d, Actuated=%d, Updated=%d, "
             "Written=%d, Delete=%d\n",
             att_internal_name(),
             (attribOwnerEntity ? attribOwnerEntity->class_name() : "(none)"),
             (attribOwnerEntity ? attribOwnerEntity->id() : 0),
             hasActuated, hasUpdated,
             hasWritten, deleteAttrib);

}