21static std::size_t normal_index(
const RectangularMesh2D* mesh, std::size_t index0, std::size_t index1) {
22 return index0 + mesh->axis[0]->size() * index1;
24static std::size_t normal_index0(
const RectangularMesh2D* mesh, std::size_t
mesh_index) {
27static std::size_t normal_index1(
const RectangularMesh2D* mesh, std::size_t
mesh_index) {
31static std::size_t transposed_index(
const RectangularMesh2D* mesh, std::size_t index0, std::size_t index1) {
32 return mesh->axis[1]->size() * index0 + index1;
34static std::size_t transposed_index0(
const RectangularMesh2D* mesh, std::size_t
mesh_index) {
37static std::size_t transposed_index1(
const RectangularMesh2D* mesh, std::size_t
mesh_index) {
43 index_f = transposed_index;
44 index0_f = transposed_index0;
45 index1_f = transposed_index1;
46 minor_axis = &
axis[1];
47 major_axis = &
axis[0];
49 index_f = normal_index;
50 index0_f = normal_index0;
51 index1_f = normal_index1;
52 minor_axis = &
axis[0];
53 major_axis = &
axis[1];
70 setChangeSignal(this->
axis[0]);
71 setChangeSignal(this->
axis[1]);
77 setChangeSignal(this->
axis[0]);
78 setChangeSignal(this->
axis[1]);
89 axis {
clone_axes ? src.axis[0]->clone() : src.axis[0],
90 clone_axes ? src.axis[1]->clone() : src.axis[1]}
93 setChangeSignal(this->
axis[0]);
94 setChangeSignal(this->
axis[1]);
105 unsetChangeSignal(this->
axis[0]);
106 unsetChangeSignal(this->
axis[1]);
137 return new VerticalBoundary(*
this,
axis[0]->findNearestIndex(
axis0_coord));
148 return new VerticalBoundary(*
this, 0);
152 return new VerticalBoundary(*
this,
axis[0]->
size()-1);
159 return new VerticalBoundaryInRange(*
this, line,
begInd,
endInd);
168 return new VerticalBoundaryInRange(*
this, line,
begInd,
endInd);
177 return new HorizontalBoundaryInRange(*
this, line,
begInd,
endInd);
186 return new HorizontalBoundaryInRange(*
this, line,
begInd,
endInd);
200 return new HorizontalBoundary(*
this,
axis[1]->findNearestIndex(
axis1_coord));
211 return new HorizontalBoundary(*
this,
axis[1]->
size()-1);
215 return new HorizontalBoundary(*
this, 0);
219 object.attr(
"type",
"rectangular2d");
220 {
auto a =
object.addTag(
"axis0");
axis[0]->writeXML(
a); }
221 {
auto a =
object.addTag(
"axis1");
axis[1]->writeXML(
a); }
229 shared_ptr<MeshAxis> axis[2];
230 XMLReader::CheckTagDuplication
dub_check;
231 for (
int i = 0; i < 2; ++i) {
233 std::string
node = reader.getNodeName();
234 if (
node !=
"axis0" &&
node !=
"axis1")
throw XMLUnexpectedElementException(reader,
"<axis0> or <axis1>");
238 reader.requireTagEnd();
242static RegisterMeshReader rectangular2d_reader(
"rectangular2d", readRectangularMesh2D);
246 writelog(
LOG_WARNING,
"Mesh type \"{0}\" is obsolete (will not work in future versions of PLaSK), use \"rectangular2d\" instead.", reader.requireAttribute(
"type"));
247 return readRectangularMesh2D(reader);
249static RegisterMeshReader regularmesh2d_reader(
"regular2d", readRectangularMesh2D_obsolete);
250static RegisterMeshReader rectilinear2d_reader(
"rectilinear2d", readRectangularMesh2D_obsolete);
254 if (this->originalMesh == c->originalMesh)
return true;