MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / expand_ellipses

Function expand_ellipses

fem/tensorcoefficient.cpp:359–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357 }
358
359 string expand_ellipses(const string& signature, const Array<shared_ptr<CoefficientFunction>>& cfs)
360 {
361 auto parts = split_signature(signature);
362 if (parts.size() - 1 != cfs.Size())
363 throw NG_EXCEPTION(
364 string("number of inputs (") + to_string(cfs.Size()) + ") " +
365 "does not match the number inferred from the signature ("
366 + to_string(parts.size() - 1) + ")");
367
368 string ellipse_symbols{};
369 ellipse_symbols.reserve(10);
370 for (auto i : Range(parts.size() - 1))
371 tie(parts[i], ellipse_symbols) = expand_ellipse(parts[i], cfs[i], signature, ellipse_symbols);
372
373 auto pos = parts.back().find("...");
374 if (pos != string::npos)
375 parts.back() = replace_ellipse(parts.back(), pos, ellipse_symbols.size(), ellipse_symbols);
376
377 for (const auto& part : parts)
378 if (part.find("...") != string::npos)
379 throw NG_EXCEPTION(string("could not expand all ellipses in signature ") + signature);
380
381 return form_index_signature(parts);
382 }
383
384 optional<string> substitute_id_index(string signature, pair<char, char> id_indices,
385 size_t id_pos, const FlatArray<bool> marked_for_removal,

Callers 1

EinsumCFFunction · 0.85

Calls 7

split_signatureFunction · 0.85
expand_ellipseFunction · 0.85
replace_ellipseFunction · 0.85
form_index_signatureFunction · 0.85
findMethod · 0.80
RangeFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected