| 1 |
// Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
#include "Ioss_CommSet.h" |
| 8 |
#include "Ioss_DatabaseIO.h" |
| 9 |
#include "Ioss_Field.h" |
| 10 |
#include "Ioss_Property.h" |
| 11 |
#include <cassert> |
| 12 |
#include <cstddef> |
| 13 |
#include <string> |
| 14 |
|
| 15 |
#include "Ioss_FieldManager.h" |
| 16 |
#include "Ioss_GroupingEntity.h" |
| 17 |
#include "Ioss_PropertyManager.h" |
| 18 |
|
| 19 |
Ioss::CommSet::CommSet(Ioss::DatabaseIO *io_database, const std::string &my_name, |
| 20 |
const std::string &entity_type, size_t entity_cnt) |
| 21 |
: Ioss::GroupingEntity(io_database, my_name, entity_cnt) |
| 22 |
{ |
| 23 |
assert(entity_type == "node" || entity_type == "side"); |
| 24 |
properties.add(Ioss::Property("entity_type", entity_type)); |
| 25 |
|
| 26 |
if (entity_type == "node") { |
| 27 |
// Field contains a pair of type [entity_id, shared_cpu] |
| 28 |
fields.add(Ioss::Field("entity_processor", field_int_type(), "pair", Ioss::Field::COMMUNICATION, |
| 29 |
entity_cnt)); |
| 30 |
fields.add(Ioss::Field("entity_processor_raw", field_int_type(), "pair", |
| 31 |
Ioss::Field::COMMUNICATION, entity_cnt)); |
| 32 |
} |
| 33 |
else { |
| 34 |
// Field contains a triplet of type [entity_id, local_side, shared_cpu] |
| 35 |
fields.add(Ioss::Field("entity_processor", field_int_type(), "Real[3]", |
| 36 |
Ioss::Field::COMMUNICATION, entity_cnt)); |
| 37 |
fields.add(Ioss::Field("entity_processor_raw", field_int_type(), "Real[3]", |
| 38 |
Ioss::Field::COMMUNICATION, entity_cnt)); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
int64_t Ioss::CommSet::internal_get_field_data(const Ioss::Field &field, void *data, |
| 43 |
size_t data_size) const |
| 44 |
{ |
| 45 |
return get_database()->get_field(this, field, data, data_size); |
| 46 |
} |
| 47 |
|
| 48 |
int64_t Ioss::CommSet::internal_put_field_data(const Ioss::Field &field, void *data, |
| 49 |
size_t data_size) const |
| 50 |
{ |
| 51 |
return get_database()->put_field(this, field, data, data_size); |
| 52 |
} |
| 53 |
|
| 54 |
int64_t Ioss::CommSet::internal_get_zc_field_data(const Field &field, void **data, |
| 55 |
size_t *data_size) const |
| 56 |
{ |
| 57 |
return get_database()->get_zc_field(this, field, data, data_size); |
| 58 |
} |
| 59 |
|
| 60 |
Ioss::Property Ioss::CommSet::get_implicit_property(const std::string &my_name) const |
| 61 |
{ |
| 62 |
return Ioss::GroupingEntity::get_implicit_property(my_name); |
| 63 |
} |