27 #ifndef CONTINUUM_PARTITION_MIXIN_H_
28 #define CONTINUUM_PARTITION_MIXIN_H_
72 std::string cwd(getcwd(
nullptr, 0));
73 std::vector<std::string> all_worker_suffixes;
76 std::string my_worker_suffix =
78 ? all_worker_suffixes[worker_rank]
91 if (worker_rank >= 0) {
92 auto modify_imagename = [&](
const char *field_val) {
93 return cwd +
"/" + field_val + my_worker_suffix;
102 if (worker_rank >= 0) {
103 auto modify_cfcache = [&](
const char *field_val) {
104 return field_val + my_worker_suffix;
113 if (worker_rank == 0 && num_workers > 1) {
114 auto accumulate_part_names =
115 [&] (std::array<casacore::Record *,2> im_norm_par) {
116 std::vector<casacore::String> part_names;
117 std::string image_path =
118 cwd +
"/" + im_norm_par[0]->asString(
"imagename").c_str();
119 for (
auto s : all_worker_suffixes) {
124 std::array<casacore::Record *,2> im_norm_params =
128 accumulate_part_names);
152 std::function<std::string(
const char *)> fn) {
154 msRec.
define(field, fn(msRec.asString(field).c_str()));
178 #endif // CONTINUUM_PARTITION_MIXIN_H_
Parameter and input data partitioning for parallel continuum imaging (in ParallelImagerMixin).
void defineRecord(const RecordFieldId &, const Record &value, RecordType type=Variable)
Define a value for the given field containing a subrecord.
casacore::Record continuumDataPartition(casacore::Record &selpars, const casacore::Int npart)
All functions here are stand-alone, self-contained methods.
casacore::Record convert_fields(casacore::Record &rec, const char *field, std::function< std::string(const char *)> fn)
Convenience method to transform certain record fields.
casacore::Record deconvolution
virtual Type type()
Return the type enum.
casacore::Record selection
casacore::Record normalization
void concat_images(const std::string &type __attribute__((unused)))
ParallelImagerParams get_params(MPI_Comm wcomm, ParallelImagerParams &initial)
#define MPI_Comm_size(c, sp)
Collection of parameters for parallel imaging, categorized roughly by imaging component.
static ParamFieldIterator end(casacore::Record *rec, const string &prefix="")
static ParamFieldIterator begin(casacore::Record *rec, const string &prefix="")
#define MPI_Comm_rank(c, rp)
A hierarchical collection of named fields of various types.
casacore::Record empty_fields(casacore::Record &rec, const char *field)
Convenience method to clear certain record fields.
std::string to_string(int i)
casacore::Record iteration
String: the storage and methods of handling collections of characters.
void define(const RecordFieldId &, Bool value)
Define a value for the given field.