@@ -72,6 +72,7 @@ subroutine store_relevant_coordinates(this, problemInfo)
7272 this% nPoints = counter
7373 call alloc_and_init(this% coords, 3 , this% nPoints, - 99 )
7474 call alloc_and_init(this% materialTag, this% nPoints, - 1 )
75+ call alloc_and_init(this% currentType, this% nPoints, - 1 )
7576
7677 counter = 0
7778 do k = this% mainCoords% Z, this% auxCoords% Z
@@ -81,13 +82,13 @@ subroutine store_relevant_coordinates(this, problemInfo)
8182 if (isWithinBounds(Hfield, i, j, k, problemInfo)) then
8283 if (isMaterialExceptPML(Hfield, i, j, k, problemInfo)) then
8384 counter = counter + 1
84- call writeFaceTagInfo(this, counter, i, j, k, problemInfo% materialTag% getFaceTag(Hfield, i, j, k))
85+ call writeFaceTagInfo(this, counter, i, j, k, Hfield, problemInfo% materialTag% getFaceTag(Hfield, i, j, k))
8586 end if
8687 if (problemInfo% materialTag% getFaceTag(Hfield, i, j, k) < 0 &
8788 .and. (btest (iabs(problemInfo% materialTag% getFaceTag(Hfield, i, j, k)), Hfield - 1 )) &
8889 .and. .not. isPML(Hfield, i, j, k, problemInfo)) then
8990 counter = counter + 1
90- call writeFaceTagInfo(this, counter, i, j, k, problemInfo% materialTag% getFaceTag(Hfield, i, j, k))
91+ call writeFaceTagInfo(this, counter, i, j, k, Hfield, problemInfo% materialTag% getFaceTag(Hfield, i, j, k))
9192 end if
9293 end if
9394 end do
@@ -103,12 +104,13 @@ logical function isMaterialExceptPML(field, i, j, k, problemInfo)
103104 isMaterialExceptPML = isMaterialExceptPML .and. (.not. isPML(field, i, j, k, problemInfo))
104105 end function isMaterialExceptPML
105106
106- subroutine writeFaceTagInfo (this , counter , i , j , k , tag )
107+ subroutine writeFaceTagInfo (this , counter , i , j , k , field , tag )
107108 type (mapvtk_output_t), intent (inout ) :: this
108- integer , intent (in ) :: i, j, k, counter, tag
109+ integer , intent (in ) :: i, j, k, counter, tag, field
109110 this% coords(1 , counter) = i
110111 this% coords(2 , counter) = j
111112 this% coords(3 , counter) = k
113+ this% currentType(counter) = currentType(field)
112114 this% materialTag(counter) = tag
113115 end subroutine
114116
@@ -135,29 +137,44 @@ subroutine create_geometry_simulation_vtu(this, control)
135137 vtuPath = join_path(this% path, get_last_component(this% path))// vtuFileExtension
136138
137139 call createUnstructuredDataForVTU(this% nPoints, this% coords, this% currentType, nodes, edges, quads, numNodes, numEdges, numQuads)
138- call ugrid% add_points(nodes)
140+ call ugrid% add_points(real ( nodes, 4 ) )
139141
140142 allocate (conn(2 * numEdges + 4 * numQuads))
141143 conn(1 :2 * numEdges) = reshape (edges, [2 * numEdges])
142144 conn(2 * numEdges + 1 :2 * numEdges + 4 * numQuads) = reshape (quads, [4 * numQuads])
143145
144146 allocate (offsets(numEdges + numQuads))
145- do i = 1 , numEdges
146- if (i == 1 ) then
147- offsets(i) = 2
147+ do i = 1 , numEdges + numQuads
148+ if (i <= numEdges) then
149+ if (i == 1 ) then
150+ offsets(i) = 2
151+ else
152+ offsets(i) = offsets(i-1 ) + 2
153+ end if
148154 else
149- offsets(i) = offsets(i - 1 ) + 2
155+ if (i == 1 ) then
156+ offsets(i) = 4
157+ else
158+ offsets(i) = offsets(i-1 ) + 4
159+ end if
150160 end if
151161 end do
152- do i = 1 , numQuads
153- offsets(numEdges + i) = offsets(numEdges + i - 1 ) + 4
154- end do
155162
156163 allocate (types(numEdges+ numQuads))
157164 types(1 :numEdges) = 3
158165 types(numEdges+1 :numEdges+ numQuads) = 9
159166
160167 call ugrid% add_cell_connectivity(conn, offsets, types)
168+ if (size (offsets) /= numQuads) then
169+ print * , " Problema con offsets"
170+ end if
171+ if (size (types) /= numQuads) then
172+ print * , " Problema con types"
173+ end if
174+ if (offsets(numQuads) /= size (conn)) then
175+ print * , " Tenemos un problema con conn y offset"
176+ end if
177+
161178 call ugrid% write_file(vtuPath)
162179
163180 !- --------------------------------------------
0 commit comments