Skip to content

Commit

Permalink
Documentation and computational methods for MultiVector
Browse files Browse the repository at this point in the history
  • Loading branch information
fsmith001 committed Jul 7, 2022
1 parent 996d437 commit 0e668ee
Show file tree
Hide file tree
Showing 15 changed files with 221 additions and 120 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Stable Docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://Collegeville.github.io/JuliaPetra.jl/stable/)
[![Latest Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://Collegeville.github.io/JuliaPetra.jl/latest/)

This is an implmentation of [Trilinos's Petra Object Model](https://trilinos.github.io/data_service.html#trilinos-packages) in Julia.
This is an implementation of [Trilinos's Petra Object Model](https://trilinos.github.io/data_service.html#trilinos-packages) in Julia.
It is a basic framework for sparse linear algebra.

## License
Expand Down
Binary file added docs/.DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions src/BlockMap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ function BlockMap(numGlobalElements::Integer, myGlobalElements::AbstractArray{GI
data.maxMyGID = 0
end

#TODO this doesn't check if there is overlap between processors
#=
this doesn't check if there is overlap between processors
data.linearMap = Bool(minAll(data.comm, linear))

=#
if numProc(comm) == 1
data.numGlobalElements = data.numMyElements
data.minAllGID = data.minMyGID
Expand Down
22 changes: 11 additions & 11 deletions src/BlockMapData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ mutable struct BlockMapData{GID <: Integer, PID <:Integer, LID <: Integer}
directory::Union{Directory, Nothing}
lid::Vector{LID}
myGlobalElements::Vector{GID}
# firstPointInElementList::Array{Integer}
# elementSizeList::Array{Integer}
# pointToElementList::Array{Integer}
firstPointInElementList::Array{Integer}
elementSizeList::Array{Integer}
pointToElementList::Array{Integer}

numGlobalElements::GID
numMyElements::LID
# elementSize::Integer
# minMyElementSize::Integer
# maxMyElementSize::Integer
# minElementSize::Integer
# maxElementSize::Integer
elementSize::Integer
minMyElementSize::Integer
maxMyElementSize::Integer
minElementSize::Integer
maxElementSize::Integer
minAllGID::GID
maxAllGID::GID
minMyGID::GID
maxMyGID::GID
minLID::LID
maxLID::LID
# numGlobalPoints::Integer
# numMyPoints::Integer
numGlobalPoints::Integer
numMyPoints::Integer

# constantElementSize::Bool
constantElementSize::Bool
linearMap::Bool
distributedGlobal::Bool
oneToOneIsDetermined::Bool
Expand Down
54 changes: 52 additions & 2 deletions src/CSRGraphExternalMethods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ function insertLocalIndices(graph::CSRGraph{GID, PID, LID}, localRow::LID,
indicesView = view(inds, 1:numEntries)
insertLocalIndices(graph, localRow, indsT)
end

function insertLocalIndices(graph::CSRGraph{GID, PID, LID}, localRow::Integer,
inds::AbstractArray{<:Integer, 1}) where {GID, PID, LID <: Integer}
insertLocalIndices(graph, LID(localRow), Array{LID, 1}(inds))
Expand Down Expand Up @@ -378,6 +377,11 @@ function insertGlobalIndicesFiltered(graph::CSRGraph{GID, PID, LID}, globalRow::
end
end

"""
getGlobalView(graph::CSRGraph, rowInfo::RowInfo)
take the graph of a CSRMatrix and get its global IDs
"""
function getGlobalView(graph::CSRGraph{GID, PID, LID}, rowInfo::RowInfo{LID}) where {GID <: Integer, PID, LID <: Integer}
if rowInfo.allocSize > 0
if length(graph.globalIndices1D) != 0
Expand All @@ -393,6 +397,11 @@ function getGlobalView(graph::CSRGraph{GID, PID, LID}, rowInfo::RowInfo{LID}) wh
end
end

"""
getGlobalViewPtr(graph::CSRGraph, rowInfo::RowInfo::Tuple)
take the graph of a CSRMatrix and get its pointers to global IDs, returned as a tuple of the pointer array and the GID array
"""
@inline function getGlobalViewPtr(graph::CSRGraph{GID, PID, LID}, rowInfo::RowInfo{LID})::Tuple{Ptr{GID}, LID} where {GID <: Integer, PID, LID <: Integer}
if rowInfo.allocSize > 0
if length(graph.globalIndices1D) != 0
Expand All @@ -405,6 +414,11 @@ end
return (Ptr{GID}(C_NULL), 0)
end

"""
getLocalView(graph::CSRGraph, rowInfo::RowInfo)
take the graph of a CSRMatrix and get its local IDs
"""
function getLocalView(graph::CSRGraph{GID, PID, LID}, rowInfo::RowInfo{LID}) where {GID <: Integer, PID, LID <: Integer}
if rowInfo.allocSize > 0
if length(graph.localIndices1D) != 0
Expand All @@ -418,7 +432,11 @@ function getLocalView(graph::CSRGraph{GID, PID, LID}, rowInfo::RowInfo{LID}) whe
return LID
end

"""
getLocalViewPtr(graph::CSRGraph, rowInfo::RowInfo)
take the graph of a CSRMatrix and get its pointers to local IDs, returned as a tuple of the pointer array and an LID
"""
Base.@propagate_inbounds @inline function getLocalViewPtr(graph::CSRGraph{GID, PID, LID}, rowInfo::RowInfo{LID})::Tuple{Ptr{LID}, LID} where {GID <: Integer, PID, LID <: Integer}
if rowInfo.allocSize > 0
if length(graph.localIndices1D) != 0
Expand All @@ -431,6 +449,11 @@ Base.@propagate_inbounds @inline function getLocalViewPtr(graph::CSRGraph{GID, P
return (C_NULL, 0)
end

"""
getGlobalRowView(graph::CSRGraph, globalRow::GID)
take the graph of a CSRMatrix and get its global IDs for a certain row number
"""
function getGlobalRowView(graph::CSRGraph{GID}, globalRow::GID)::AbstractArray{GID, 1} where {GID <: Integer}
if isLocallyIndexed(graph)
throw(InvalidArgumentError("The graph's indices are currently stored as local indices, so a view with global column indices cannot be returned. Use getGlobalRowCopy(::CSRGraph) instead"))
Expand All @@ -447,6 +470,11 @@ function getGlobalRowView(graph::CSRGraph{GID}, globalRow::GID)::AbstractArray{G
retVal
end

"""
getGlobalRowViewPtr(graph::CSRGraph, globalRow::GID)
take the graph of a CSRMatrix and get its pointers to global IDs, returned as a tuple of the pointer array and an LID
"""
Base.@propagate_inbounds function getGlobalRowViewPtr(graph::CSRGraph{GID, PID, LID}, globalRow::GID)::Tuple{Ptr{GID}, LID} where {GID <: Integer, PID <: Integer, LID <: Integer}
if isLocallyIndexed(graph)
throw(InvalidArgumentError("The graph's indices are currently stored as local indices, so a view with global column indices cannot be returned. Use getGlobalRowCopy(::CSRGraph) instead"))
Expand All @@ -466,14 +494,19 @@ Base.@propagate_inbounds function getGlobalRowViewPtr(graph::CSRGraph{GID, PID,
retVal
end

"""
getLocalRowView(graph::CSRGraph, localRow::GID)
getLocalRowView(graph::CSRGraph, rowInfo::RowInfo)
takes the graph of a CSRMatrix and returns as an array of local IDs for a certain row number
"""
function getLocalRowView(graph::CSRGraph{GID}, localRow::GID)::AbstractArray{GID, 1} where {GID}
rowInfo = getRowInfoFromLocalRowIndex(graph, localRow)

retVal = getLocalRowView(graph, rowInfo)
recycleRowInfo(rowInfo)
retVal
end

function getLocalRowView(graph::CSRGraph{GID, PID, LID}, rowInfo::RowInfo{LID}
)::AbstractArray{GID, 1} where {GID, PID, LID}

Expand All @@ -490,6 +523,11 @@ end

resumeFill(graph::CSRGraph; plist...) = resumeFill(graph, Dict(plist))

"""
resumeFill(graph::CSRGraph, plist::Dict)
set boolean values to allow filling the CSRGraph
"""
function resumeFill(graph::CSRGraph, plist::Dict)
if !hasRowInfo(graph)
throw(InvalidStateError("Cannot resume fill of the CSRGraph, "
Expand All @@ -508,6 +546,13 @@ end

fillComplete(graph::CSRGraph; plist...) = fillComplete(graph, Dict(plist))

"""
fillComplete(graph::CSRGraph, plist::Dict)
fillComplete(graph::CSRGraph, domainMap::BlockMap, rangeMap::BlockMap, plist::Dict)
fillComplete(graph::CSRGraph, domainMap::BlockMap, rangeMap::BlockMap, plist...)
returns a boolean of whether the graph is filled
"""
function fillComplete(graph::CSRGraph, plist::Dict)
if graph.domainMap === nothing
domMap = graph.rowMap
Expand Down Expand Up @@ -566,6 +611,11 @@ function fillComplete(graph::CSRGraph{GID, PID, LID}, domainMap::BlockMap{GID, P
checkInternalState(graph)
end

"""
makeColMap(graph::CSRGraph)
make a map of the columns using the given CSRGraph
"""
function makeColMap(graph::CSRGraph{GID, PID, LID}) where {GID, PID, LID}
localNumRows = getLocalNumEntries(graph)

Expand Down
Loading

0 comments on commit 0e668ee

Please sign in to comment.