cgma
CABodies Class Reference

#include <CABodies.hpp>

Inheritance diagram for CABodies:
CubitAttrib

List of all members.

Public Member Functions

virtual ~CABodies ()
 CABodies (RefEntity *)
 CABodies (RefEntity *, CubitSimpleAttrib *)
virtual const std::type_info & entity_type_info () const
CubitStatus actuate ()
CubitStatus update ()
CubitSimpleAttrib cubit_simple_attrib ()
CubitStatus reset ()
int int_attrib_type ()

Private Attributes

int m_interface
int m_uniqueID
DLIList< int > m_sharedBodies
DLIList< int > m_sharedProcs
DLIList< int > m_ghostProcs

Detailed Description

Definition at line 18 of file CABodies.hpp.


Constructor & Destructor Documentation

CABodies::~CABodies ( ) [virtual]

Definition at line 90 of file CABodies.cpp.

{
}
CABodies::CABodies ( RefEntity new_attrib_owner)

Definition at line 77 of file CABodies.cpp.

  : CubitAttrib(new_attrib_owner)
  , m_interface(0)
  , m_uniqueID(0)
{
  if (DEBUG_FLAG(138))
  {
  PRINT_DEBUG_138( "Creating BODIES attribute for %s %d\n",
              (attribOwnerEntity ? attribOwnerEntity->class_name() : "(none)"),
              (attribOwnerEntity ? attribOwnerEntity->id() : 0));
  }
}
CABodies::CABodies ( RefEntity new_attrib_owner,
CubitSimpleAttrib csa_ptr 
)

Definition at line 25 of file CABodies.cpp.

  : CubitAttrib(new_attrib_owner)
{
  assert ( csa_ptr != NULL );
  if (DEBUG_FLAG(138))
  {
    PRINT_DEBUG_138( "Creating BODIES attribute from CSA for %s %d\n",
             (attribOwnerEntity ? attribOwnerEntity->class_name() : "(none)"),
             (attribOwnerEntity ? attribOwnerEntity->id() : 0));
  }

  std::vector<int> i_list = csa_ptr->int_data_list();

  // first, the ints
  if (i_list.size() > 0)
  {
    m_interface = i_list[0]; // is interface

    if (i_list.size() > 1)
    {
      m_uniqueID = i_list[1]; // unique ID

      if(i_list.size() > 2)
      {
        // shared bodies
        int num_list = i_list[2];
        for (int i = 0; i < num_list; i++) 
          m_sharedBodies.append(i_list[3+i]);

        // shared procs
        int new_start = 3 + num_list;
        if((int)i_list.size() > new_start + 1)
        {
          num_list = i_list[new_start];
          for (int i = 1; i <= num_list; i++) 
           m_sharedProcs.append(i_list[new_start + i]);

          // ghost procs
          new_start += num_list+1;
          if((int)i_list.size() > new_start + 1)
          {
           num_list = i_list[new_start];
           for (int i = 1; i <= num_list; i++) 
             m_ghostProcs.append(i_list[new_start + i]);
          } 
        }
      }
    }
  }
}

Member Function Documentation

Implements CubitAttrib.

Definition at line 94 of file CABodies.cpp.

{
  CubitStatus status = CUBIT_SUCCESS;

  if (hasActuated == CUBIT_TRUE) return CUBIT_SUCCESS;

  if (DEBUG_FLAG(138))
  {
    PRINT_DEBUG_138( "Actuating BODIES attribute for %s %d\n",
             attribOwnerEntity->class_name(), attribOwnerEntity->id());
  }

  // create a TDParallel for the entity, if it doesn't already exist
  TDParallel *par = (TDParallel *) attrib_owner()->get_TD(&TDParallel::is_parallel);

  if (par != NULL) {
    if (par->is_interface() != m_interface) {
      PRINT_ERROR("TDParallel interface check is failed for %s %d.\n",
          attrib_owner()->class_name(), attrib_owner()->id());
      return CUBIT_FAILURE;
    }

    // check to make sure it's the same body list
    par->get_shared_body_list()->reset();
    m_sharedBodies.reset();
    int size = par->get_shared_body_list()->size();

    for (int i = 0; i < size; i++) {
      if (par->get_shared_body_list()->get_and_step() != m_sharedBodies.get_and_step()) {
    PRINT_ERROR("Different body found for %s %d.\n",
            attrib_owner()->class_name(), attrib_owner()->id());
    return CUBIT_FAILURE;
      }
    }

    par->get_shared_proc_list()->reset();
    m_sharedProcs.reset();
    size = par->get_shared_proc_list()->size();

    for (int i = 0; i < size; i++) {
      if (par->get_shared_proc_list()->get_and_step() != m_sharedProcs.get_and_step()) {
    PRINT_ERROR("Different processor found for %s %d.\n",
            attrib_owner()->class_name(), attrib_owner()->id());
    return CUBIT_FAILURE;
      }
    }

    par->get_ghost_proc_list()->reset();
    m_ghostProcs.reset();
    size = par->get_ghost_proc_list()->size();

    for (int i = 0; i < size; i++) {
      if (par->get_ghost_proc_list()->get_and_step() != m_ghostProcs.get_and_step()) {
    PRINT_ERROR("Different ghost processor found for %s %d.\n",
            attrib_owner()->class_name(), attrib_owner()->id());
    return CUBIT_FAILURE;
      }
    }

    if ((int)par->get_unique_id() != m_uniqueID) {
      PRINT_ERROR("Different unique ID found for %s %d.\n",
          attrib_owner()->class_name(), attrib_owner()->id());
      return CUBIT_FAILURE;
    }
  }
  else {
    // else make a new one
    par = new TDParallel(attrib_owner(), &m_sharedBodies, &m_sharedProcs,
             &m_ghostProcs, m_uniqueID, m_interface);
  }

  delete_attrib(CUBIT_TRUE);
  hasActuated = CUBIT_TRUE;

  return status;
}

Implements CubitAttrib.

Definition at line 223 of file CABodies.cpp.

{
  std::vector<CubitString> cs_list;
  std::vector<int> i_list;

  // attribute internal name
  cs_list.push_back(att_internal_name());

  // is interface
  i_list.push_back(m_interface);

  // unique ID
  i_list.push_back(m_uniqueID);

  // shared bodies
  i_list.push_back(m_sharedBodies.size());
  int i;
  for (i = m_sharedBodies.size(); i > 0; i--) {
    i_list.push_back(m_sharedBodies.get_and_step());
  }

  // shared procs
  i_list.push_back(m_sharedProcs.size());
  for (i = m_sharedProcs.size(); i > 0; i--) {
    i_list.push_back(m_sharedProcs.get_and_step());
  }

  // ghost procs
  i_list.push_back(m_ghostProcs.size());
  for (i = m_ghostProcs.size(); i > 0; i--) {
    i_list.push_back(m_ghostProcs.get_and_step());
  }
  
  CubitSimpleAttrib csattrib =  CubitSimpleAttrib(&cs_list, NULL, &i_list);
  
  return csattrib;
}
const std::type_info & CABodies::entity_type_info ( ) const [virtual]

Definition at line 267 of file CABodies.cpp.

{
  return typeid(CABodies);
}
int CABodies::int_attrib_type ( ) [virtual]

Implements CubitAttrib.

Definition at line 272 of file CABodies.cpp.

{
  return CA_BODIES;
}

Implements CubitAttrib.

Definition at line 261 of file CABodies.cpp.

Implements CubitAttrib.

Definition at line 171 of file CABodies.cpp.

{
  if (hasUpdated) return CUBIT_SUCCESS;
  
  if (DEBUG_FLAG(138))
  {
    PRINT_DEBUG_138( "Updating BODIES attribute for %s %d\n",
              attribOwnerEntity->class_name(), attribOwnerEntity->id());
  }

  // set the updated flag
  hasUpdated = CUBIT_TRUE;
  
  // if the owner has a body list, save it, otherwise delete this one
  TDParallel *td_par = (TDParallel *) attrib_owner()->get_TD(&TDParallel::is_parallel);
  
  if (td_par == NULL) {
    delete_attrib(CUBIT_TRUE);
  }
  else {
    m_interface = td_par->is_interface();
    m_uniqueID = td_par->get_unique_id();
    int size = td_par->get_shared_body_list()->size();
    td_par->get_shared_body_list()->reset();
    m_sharedBodies.clean_out();

    for (int i = 0; i < size; i++) {
      m_sharedBodies.append(td_par->get_shared_body_list()->get_and_step());
    }

    size = td_par->get_shared_proc_list()->size();
    td_par->get_shared_proc_list()->reset();
    m_sharedProcs.clean_out();

    for (int i = 0; i < size; i++) {
      m_sharedProcs.append(td_par->get_shared_proc_list()->get_and_step());
    }

    size = td_par->get_ghost_proc_list()->size();
    td_par->get_ghost_proc_list()->reset();
    m_ghostProcs.clean_out();

    for (int i = 0; i < size; i++) {
      m_ghostProcs.append(td_par->get_ghost_proc_list()->get_and_step());
    }
    
    if (delete_attrib() == CUBIT_TRUE) delete_attrib(CUBIT_FALSE);
  }

  return CUBIT_SUCCESS;
}

Member Data Documentation

Definition at line 28 of file CABodies.hpp.

int CABodies::m_interface [private]

Definition at line 22 of file CABodies.hpp.

Definition at line 24 of file CABodies.hpp.

Definition at line 26 of file CABodies.hpp.

int CABodies::m_uniqueID [private]

Definition at line 22 of file CABodies.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines