Changeset 26628
- Timestamp:
- 11/16/21 07:08:06 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/jl/solve.jl
r26622 r26628 135 135 svalues::Vector{Float64} 136 136 end# }}} 137 function Base.show(io::IO, this::Node)# {{{ 138 139 println(io,"Node:") 140 println(io," id: ",this.id) 141 println(io," sid: ",this.sid) 142 println(io," indexingupdate: ",this.indexingupdate) 143 println(io," gsize: ",this.gsize) 144 println(io," gdoflist: ",this.gdoflist) 145 println(io," fdoflist: ",this.fdoflist) 146 println(io," sdoflist: ",this.sdoflist) 147 println(io," svalues: ",this.svalues) 148 end# }}} 149 function ApplyConstraint(node::Node,dof::Int8,value::Float64) #{{{ 150 151 node.indexingupdate = true 152 node.fdoflist[dof] = -1 153 node.sdoflist[dof] = +1 154 node.svalues[dof] = value 155 156 end# }}} 137 157 struct Constraint #{{{ 138 158 id::Int64 … … 140 160 dof::Int8 141 161 value::Float64 162 end# }}} 163 function ConstrainNode(constraint::Constraint,nodes::Vector{Node},parameters::Parameters) #{{{ 164 165 #Chase through nodes and find the node to which this SpcStatic apply 166 node = nodes[constraint.nodeid] 167 168 #Apply Constraint 169 ApplyConstraint(node,constraint.dof,constraint.value) 170 142 171 end# }}} 143 172 mutable struct Vertex#{{{ … … 254 283 ConfigureObjectx(elements,nodes,vertices,parameters,inputs) 255 284 285 #Constrain and Number nodes 286 SpcNodesx(nodes,constraints,parameters) 287 NodesDofx(nodes,parameters) 288 error("STOP") 289 256 290 #Build FemModel 257 291 return FemModel(elements,vertices,nodes,parameters,inputs,constraints) … … 265 299 tempinputs = Inputs(-1,-1,Dict{IssmEnum,Input}()) 266 300 tempvertices = Vector{Vertex}(undef,3) 267 tempnodes = Vector{Node}(undef, 0)301 tempnodes = Vector{Node}(undef,3) 268 302 269 303 count = 0 270 304 for i in 1:md.mesh.numberofelements 271 push!(elements,Tria(i,count,md.mesh.elements[i,:],tempvertices,Vector{Int64}(undef,0),tempnodes,tempparams,tempinputs)) 305 306 #Assume Linear Elements for now 307 vertexids = md.mesh.elements[i,:] 308 nodeids = md.mesh.elements[i,:] 309 310 #Call constructor and add to dataset elements 311 push!(elements,Tria(i,count,vertexids,tempvertices,nodeids,tempnodes,tempparams,tempinputs)) 272 312 end 273 313 … … 307 347 end 308 348 349 end# }}} 350 function SpcNodesx(nodes::Vector{Node},constraints::Vector{Constraint},parameters::Parameters) #{{{ 351 352 for i in 1:length(constraints) 353 ConstrainNode(constraints[i],nodes,parameters) 354 end 355 356 end# }}} 357 function NodesDofx(nodes::Vector{Node}, parameters::Parameters) #{{{ 358 359 error("not implemented yet") 309 360 310 361 end# }}} … … 321 372 numdof = 2 322 373 for i in 1:md.mesh.numberofvertices 323 push!(nodes,Node(i,i,true,numdof, Vector{Int64}(undef,numdof), Vector{Int64}(undef,numdof), Vector{Int64}(undef,numdof), zeros(numdof)))374 push!(nodes,Node(i,i,true,numdof,-ones(Int64,numdof), ones(Int64,numdof), -ones(Int64,numdof), zeros(numdof))) 324 375 end 325 376 end#}}} … … 426 477 end 427 478 479 #Configure nodes (assuming P1 finite elements) 480 for i in 1:3 481 element.nodes[i] = nodes[element.nodeids[i]] 482 end 483 428 484 #Point to real datasets 429 485 element.parameters = parameters
Note:
See TracChangeset
for help on using the changeset viewer.