25 Eigen::VectorXd pointCoords,
28 : _point(
std::move(pointCoords)),
29 _mesh(
std::move(meshToWatch)),
30 _txtWriter(exportFilename)
34 _mesh->getDimensions());
41 for (
size_t i = 0; i <
_mesh->data().size(); i++) {
60 if (
_mesh->nVertices() > 0) {
61 auto match =
_mesh->index().findCellOrProjection(
_point, 4);
63 _interpolation = std::make_unique<mapping::Polation>(std::move(match.polation));
77 if (closestDistanceLocal < closestDistanceGlobal) {
78 closestDistanceGlobal = closestDistanceLocal;
79 closestRank = secondaryRank;
100 Eigen::VectorXd coords = Eigen::VectorXd::Constant(
_mesh->getDimensions(), 0.0);
102 coords += elem.weight *
_mesh->vertex(elem.vertexID).getCoords();
104 if (coords.size() == 2) {
111 if (elem->getDimensions() > 1) {
112 Eigen::VectorXd toExport = Eigen::VectorXd::Zero(
_mesh->getDimensions());
114 if (coords.size() == 2) {
121 double valueToExport = 0.0;
129 Eigen::VectorXd &value,
132 int dim =
_mesh->getDimensions();
133 Eigen::VectorXd temp(dim);
134 const Eigen::VectorXd &values = data->values();
136 int offset = elem.vertexID * dim;
137 for (
int i = 0; i < dim; i++) {
138 temp[i] = values[offset + i];
149 const Eigen::VectorXd &values = data->values();
151 value += elem.weight * values[elem.vertexID];
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
#define PRECICE_ASSERT(...)
void getValue(Eigen::VectorXd &value, mesh::PtrData &data)
void exportPointData(double time)
Writes one line with data of the watchpoint into the output file.
std::vector< mesh::PtrData > _dataToExport
io::TXTTableWriter _txtWriter
WatchPoint(Eigen::VectorXd pointCoords, mesh::PtrMesh meshToWatch, const std::string &exportFilename)
Constructor.
const mesh::PtrMesh & mesh() const
std::unique_ptr< mapping::Polation > _interpolation
bool _isClosest
Holds the information if this processor is the closest.
DataType
Constants defining possible data types to be written.
void addData(const std::string &name, DataType type)
Adds a data entry to the table.
void writeData(const std::string &name, int value)
Writes a integral scalar data value associated to the entry name.
static Rank getRank()
Current rank.
static bool isPrimary()
True if this process is running the primary rank.
static auto allSecondaryRanks()
Returns an iterable range over salve ranks [1, _size)
static bool isSecondary()
True if this process is running a secondary rank.
static com::PtrCommunication & getCommunication()
Intra-participant communication.