Skip to content

Commit

Permalink
make initialization optional
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrKryslUCSD committed Mar 14, 2023
1 parent 3f3c8ca commit 8f6483f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FinEtools"
uuid = "91bb5406-6c9a-523d-811d-0644c4229550"
authors = ["Petr Krysl <[email protected]>"]
version = "6.0.8"
version = "6.0.9"

[deps]
ChunkSplitters = "ae650224-84b6-46f8-82ea-d812ca08434e"
Expand Down
51 changes: 34 additions & 17 deletions src/AssemblyModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,26 @@ function startassembly!(
elem_mat_ncols,
elem_mat_nmatrices,
ndofs_row,
ndofs_col,
ndofs_col;
force_init = false
)
# Only reset the buffers if the pointer is less than 1
# Only resize the buffers if the pointer is less than 1
if self.buffer_pointer < 1
self.buffer_length = elem_mat_nmatrices * elem_mat_nrows * elem_mat_ncols
resize!(self.rowbuffer, self.buffer_length)
resize!(self.colbuffer, self.buffer_length)
resize!(self.matbuffer, self.buffer_length)
self.rowbuffer .= 1
self.colbuffer .= 1
self.matbuffer .= 0
self.buffer_pointer = 1
self.ndofs_row = ndofs_row
self.ndofs_col = ndofs_col
end
# Leave the buffers uninitialized, unless the user requests otherwise
if force_init
self.rowbuffer .= 1
self.colbuffer .= 1
self.matbuffer .= 0
end

return self
end

Expand Down Expand Up @@ -326,19 +331,23 @@ function startassembly!(
ignore1,
elem_mat_nmatrices,
ndofs,
ignore2,
ignore2;
force_init = false
)
# Only reset the buffers if the pointer is less than 1
# Only resize the buffers if the pointer is less than 1
if self.buffer_pointer < 1
self.buffer_length = elem_mat_nmatrices * elem_mat_dim^2
resize!(self.rowbuffer, self.buffer_length)
resize!(self.colbuffer, self.buffer_length)
resize!(self.matbuffer, self.buffer_length)
self.buffer_pointer = 1
self.ndofs = ndofs
end
# Leave the buffers uninitialized, unless the user requests otherwise
if force_init
self.rowbuffer .= 1
self.colbuffer .= 1
self.matbuffer .= 0
self.buffer_pointer = 1
self.ndofs = ndofs
end
return self
end
Expand Down Expand Up @@ -488,19 +497,23 @@ function startassembly!(
ignore1,
elem_mat_nmatrices,
ndofs,
ignore2,
ignore2;
force_init = false
)
# Only reset the buffers if the pointer is less than 1
# Only resize the buffers if the pointer is less than 1
if self.buffer_pointer < 1
self.buffer_length = elem_mat_nmatrices * elem_mat_dim + 1
resize!(self.rowbuffer, self.buffer_length)
resize!(self.colbuffer, self.buffer_length)
resize!(self.matbuffer, self.buffer_length)
self.buffer_pointer = 1
self.ndofs = ndofs
end
# Leave the buffers uninitialized, unless the user requests otherwise
if force_init
self.rowbuffer .= 1
self.colbuffer .= 1
self.matbuffer .= 0
self.buffer_pointer = 1
self.ndofs = ndofs
end
return self
end
Expand Down Expand Up @@ -777,19 +790,23 @@ function startassembly!(
ignore1,
elem_mat_nmatrices,
ndofs,
ignore2,
ignore2;
force_init = false
)
# Only reset the buffers if the pointer is less than 1
# Only resize the buffers if the pointer is less than 1
if self.buffer_pointer < 1
self.buffer_length = elem_mat_nmatrices * elem_mat_dim^2
resize!(self.rowbuffer, self.buffer_length)
resize!(self.colbuffer, self.buffer_length)
resize!(self.matbuffer, self.buffer_length)
self.buffer_pointer = 1
self.ndofs = ndofs
end
# Leave the buffers uninitialized, unless the user requests otherwise
if force_init
self.rowbuffer .= 1
self.colbuffer .= 1
self.matbuffer .= 0
self.buffer_pointer = 1
self.ndofs = ndofs
end
return self
end
Expand Down

2 comments on commit 8f6483f

@PetrKryslUCSD
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/79566

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v6.0.9 -m "<description of version>" 8f6483fdb83b46d5af695fddf1a7a5fb2c77c546
git push origin v6.0.9

Please sign in to comment.