cgma
TDParallel Class Reference

#include <TDParallel.hpp>

Inheritance diagram for TDParallel:
ToolData

List of all members.

Public Member Functions

 TDParallel (ToolDataUser *owner=NULL, DLIList< int > *shared_bodies=NULL, DLIList< int > *shared_procs=NULL, DLIList< int > *ghost_procs=NULL, int unique_id=-1, int interface=0)
virtual ~TDParallel ()
DLIList< int > * get_shared_body_list ()
CubitStatus set_shared_body_list ()
DLIList< int > * get_shared_proc_list ()
void set_shared_proc_list (DLIList< int > list)
DLIList< int > * get_ghost_proc_list ()
DLIList< int > * get_local_body_list ()
DLIList< int > * get_non_local_body_list ()
ToolDataUserowner_entity ()
void owner_entity (ToolDataUser *owner)
unsigned int get_charge_proc ()
void set_charge_proc (unsigned int proc)
unsigned int get_counter_proc ()
void set_counter_proc (unsigned int proc)
unsigned int get_unique_id ()
void set_unique_id (unsigned int id)
int is_interface ()
unsigned int get_n_shared_procs ()
void add_shared_proc (unsigned int proc)
void add_ghost_proc (unsigned int proc)
bool is_shared_proc (unsigned int proc)

Static Public Member Functions

static int is_parallel (const ToolData *td)

Private Attributes

DLIList< int > m_sharedBodyList
DLIList< int > m_bodyToProcList
DLIList< int > m_localBodyList
DLIList< int > m_nonLocalBodyList
DLIList< int > m_sharedProcList
DLIList< int > m_ghostProcList
ToolDataUserownerEntity
int m_uniqueId
int m_interface

Detailed Description

Definition at line 17 of file TDParallel.hpp.


Constructor & Destructor Documentation

TDParallel::TDParallel ( ToolDataUser owner = NULL,
DLIList< int > *  shared_bodies = NULL,
DLIList< int > *  shared_procs = NULL,
DLIList< int > *  ghost_procs = NULL,
int  unique_id = -1,
int  interface = 0 
)

Definition at line 18 of file TDParallel.cpp.

  : m_uniqueId(unique_id), m_interface(interface)
{
  ownerEntity = owner;

  // shared bodies
  if (shared_bodies == NULL) {
    CubitStatus status = set_shared_body_list();
    if (CUBIT_SUCCESS != status) {
      PRINT_ERROR("Failed to set shared body list.\n");
    }
  }
  else {
    int size = shared_bodies->size();
    shared_bodies->reset();
    m_sharedBodyList.clean_out();
    for (int i = 0; i < size; i++) {
      m_sharedBodyList.append(shared_bodies->get_and_step());
    }
  }

  if (shared_procs != NULL) {
    int shared_size = shared_procs->size();
    shared_procs->reset();
    m_sharedProcList.clean_out();
    for (int i = 0; i < shared_size; i++) {
      m_sharedProcList.append(shared_procs->get_and_step());
    }
  }

  if (ghost_procs != NULL) {
    int ghost_size = ghost_procs->size();
    ghost_procs->reset();
    m_ghostProcList.clean_out();
    for (int i = 0; i < ghost_size; i++) {
      m_ghostProcList.append(ghost_procs->get_and_step());
    }
  }

  //set_local_non_local_body_list();
  ownerEntity->add_TD(this);
  
    // update the attribute if this is a CAU
  CubitAttribUser *cau = CAST_TO(owner, CubitAttribUser);
  
  if (cau) {
    CubitAttrib *attrib = cau->get_cubit_attrib(CA_BODIES);
    attrib->has_updated(CUBIT_FALSE);
    attrib->update();
  }
}
TDParallel::~TDParallel ( ) [virtual]

Definition at line 77 of file TDParallel.cpp.

{
}

Member Function Documentation

void TDParallel::add_ghost_proc ( unsigned int  proc) [inline]

Definition at line 155 of file TDParallel.hpp.

{
  if (proc != get_charge_proc()) {
    m_ghostProcList.append_unique(proc);
  }
}
void TDParallel::add_shared_proc ( unsigned int  proc) [inline]

Definition at line 150 of file TDParallel.hpp.

unsigned int TDParallel::get_charge_proc ( ) [inline]

Definition at line 115 of file TDParallel.hpp.

{
  return m_sharedProcList[0];
}
unsigned int TDParallel::get_counter_proc ( ) [inline]

Definition at line 125 of file TDParallel.hpp.

{
  return m_sharedProcList[1];
}

Definition at line 111 of file TDParallel.hpp.

                                                     {
  return &m_ghostProcList;
}

Definition at line 99 of file TDParallel.hpp.

                                                     {
  return &m_localBodyList;
}
unsigned int TDParallel::get_n_shared_procs ( ) [inline]

Definition at line 145 of file TDParallel.hpp.

{
  return m_sharedProcList.size();
}

Definition at line 103 of file TDParallel.hpp.

                                                         {
  return &m_nonLocalBodyList;
}

Definition at line 81 of file TDParallel.cpp.

{
  return &m_sharedBodyList;
}

Definition at line 107 of file TDParallel.hpp.

                                                      {
  return &m_sharedProcList;
}
unsigned int TDParallel::get_unique_id ( ) [inline]

Definition at line 135 of file TDParallel.hpp.

{
  return m_uniqueId;
}
int TDParallel::is_interface ( ) [inline]

Definition at line 95 of file TDParallel.hpp.

                                    {
  return m_interface;
}
int TDParallel::is_parallel ( const ToolData td) [static]

Definition at line 72 of file TDParallel.cpp.

{
  return (CAST_TO(const_cast<ToolData*>(td), TDParallel) != NULL);
}
bool TDParallel::is_shared_proc ( unsigned int  proc) [inline]

Definition at line 162 of file TDParallel.hpp.

Definition at line 70 of file TDParallel.hpp.

{return ownerEntity;};
void TDParallel::owner_entity ( ToolDataUser owner) [inline]

Definition at line 72 of file TDParallel.hpp.

{ownerEntity = owner;};
void TDParallel::set_charge_proc ( unsigned int  proc) [inline]

Definition at line 120 of file TDParallel.hpp.

void TDParallel::set_counter_proc ( unsigned int  proc) [inline]

Definition at line 130 of file TDParallel.hpp.

Definition at line 86 of file TDParallel.cpp.

{  
  // get the bodies containing ownerEntity
  Body *body;
  DLIList<Body*> body_list;
  int i;

  CubitStatus result = (dynamic_cast<TopologyEntity*> (ownerEntity))->bodies(body_list);
  if (CUBIT_SUCCESS != result) return result;

  // write the data for the bodies to this TD
  for(i = body_list.size(); i > 0; i--)
  {
    // get the body which gets assigned to this TDParallel
    body = body_list.get_and_step();

    // append to this TDParallel the id of the body;
    m_sharedBodyList.append(TDUniqueId::get_unique_id(body));
  }

  return CUBIT_SUCCESS;
}

Definition at line 109 of file TDParallel.cpp.

{
  m_sharedProcList.clean_out();
  list.reset();
  for (int i = list.size(); i > 0; i--) {
    m_sharedProcList.append(list.get_and_step());
  }
}
void TDParallel::set_unique_id ( unsigned int  id) [inline]

Definition at line 140 of file TDParallel.hpp.

{
   m_uniqueId = id;
}

Member Data Documentation

Definition at line 25 of file TDParallel.hpp.

Definition at line 37 of file TDParallel.hpp.

int TDParallel::m_interface [private]

Definition at line 46 of file TDParallel.hpp.

Definition at line 28 of file TDParallel.hpp.

Definition at line 31 of file TDParallel.hpp.

Definition at line 22 of file TDParallel.hpp.

Definition at line 35 of file TDParallel.hpp.

int TDParallel::m_uniqueId [private]

Definition at line 43 of file TDParallel.hpp.

Definition at line 40 of file TDParallel.hpp.


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