Sharing, Reproducing, and Contributing using GitHub
GitHub
GitHub [1] helps you to create repositories, fork repositories, and work together. The first section is about reproducing the project. The other sections are advanced sections related to creating your own GitHub account and contributing. The example project has also been contributed to VTK [2] - VTK/Python & VTK/Cxx.
Reproducing the Visualization work of author in HPC
VTK/Python:
When you clone the repository, https://github.com/sxg125/NOVCA-Visualization, in your home directory in HPC, you will see the NOVCA-Visualization Directory. Go to that directory
cd NOVCA-Visualization
Checkout or change directory (cd) to the branch (VTKPython):
git checkout VTKPython
you will find all the files that you can work on. Find the python script "paraviewGraph.py" and PNG file "graph.png".
See the PNG file that you will be creating in ParaView:
display graph.png
Load the vtk and python module
module load vtk
module load python
Run the python script:
python paraviewGraph.py
You will get the vertex.vtu file which needs to be fed to the ParaView. Open the file in ParaView, apply glyph and get the one similar to graph, graph.png.
VTK/Cxx:
Load the github module
module load git
Checkout or CD to the branch (VTKCxx):
git checkout VTKCxx
Follow the "CWRU" specific guide" at https://github.com/sxg125/NOVCA-Visualization/tree/VTKCxx under README.
Note: The project has also been shared as Examples in VTK [2] - VTK/Python & VTK/Cxx.
Creating GitHub Account
Go to github.com and sign up (free option available)
Create a repository with description and version - e.g. NOVCA-Visualization
Under Branch, create a new branch - e.g. april_21_2015
Clone and Update Repository
Login to HPC and go to the directory where you want to create a directory to clone the repository.
cd <path-to-directory-for-repository>
Load the GIT module
module load git
Clone a Repository - e.g. https://github.com/sxg125/NOVCA-Visualization. It is the a content under "HTTPS Clone url". You can copy and paste.
git clone <Repository>
output:
Initialized empty Git repository in /home/sxg125/Software/vtk/WriteVTP/NOVCA-Visualization/.git/
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
You will see the repository (e.g NOVCA-Visualization) directory created. Change the directory to it
cd <repository-directory>
Checkout or CD to the branch (VTKPython):
git checkout <branch>
output:
Switched to branch 'VTKPython'
You may want to create branch for better version control (optional):
git branch <branch-name>
Make sure the branch is added in one of the files under .git directory:
grep -R <branch> .git*
output:
.git/packed-refs:f6c2cb1527b061dd566e07b7e70c78a262e32e38 refs/remotes/origin/april_21_2015
.git/logs/HEAD:f6c2cb1527b061dd566e07b7e70c78a262e32e38 f6c2cb1527b061dd566e07b7e70c78a262e32e38 Sanjaya Gajurel <sxg125@hpclogin.tis.cwru.edu> 1429649827 -0400checkout: moving from master to april_21_2015
.git/HEAD:ref: refs/heads/april_21_2015
Copy files (e.g. paraviewGraph.py & graph.png) you want to include in the repository and make required changes in "README.md" and other files in the local (HPC) repository.
cp <files> .
Add the files (e.g. paraviewGraph.py) in the local (HPC) repository.
git add paraviewGraph.py
Use "git rm" to remove files from the working tree and the index
See the status of the added file or the updated file:
git status
output:
# On branch april_21_2015
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: paraviewGraph.py
Commit the files that you have staged in your local repository. You can write appropriate comment within quotes.
git commit -m 'First Commit'
output:
[april_21_2015 77178c1] First Commit
Committer: Sanjaya Gajurel <sxg125@hpclogin.tis.cwru.edu>
...
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author='Your Name <you@example.com>'
So, fix the identity if necessary:
git commit --amend --author='Sanjaya Gajurel <sxg125@case.edu>' or git commit --amend --reset-author
Tag the remote host (GitHub location) - e.g "novca"
git remote add <your-tag> <HTTPS location url>
Verify the remote repository:
git remote -v
output:
novca https://github.com/sxg125/NOVCA-Visualization (fetch)
novca https://github.com/sxg125/NOVCA-Visualization (push)
origin https://github.com/sxg125/NOVCA-Visualization (fetch)
origin https://github.com/sxg125/NOVCA-Visualization (push)
Push the changes to the remote repository (e.g. novca as <your-assigned-tag>)
git push -f -u <your-assigned-tag>
It will prompt you for GitHub username and password, and you can see "You recently pushed branches" e.g. april_21_2015
Collaborative Effort (Forking)
Login to your github; see the section "Creating a GitHub account"
Search for the repository and fork - e.g. repository https://github.com/sxg125/NOVCA-Visualization
Click on fork button on the top right; So, repository e.g. NOVCA-Visualization will be included in your own repository
Click on the link to the file that you want to modify and edit it with edit button or click on "+" after NOVCA-Visualization to add a file.
Write the changes under "Commit Changes" and commit it. It has been a local commit.
Click on "pull request" button
Click on "Create Pull Request". This will sent the request to the author to merge the change and the author can either commit or not.
For better collaborative effort, after forking, clone the repository, work on it, and push it back and then send pull request following the above section "Clone & Submit repository"
README: GitHub Flavored Markdown (GFM)
If you want to embellish your GitHub Readme file and make it more readable, you can follow the instructions at GitHub Markdown [3]. As an example, the following markdown contents almost replicate the format used for HPC documentation. The result is showed as README.md file in https://github.com/sxg125/NOVCA-Visualization.
# Table of Contents
1. [NOVCA-Visualization](#NOVCA-Visualization)
2. [CWRU HPC Specific Guide](#CWRU HPC Specific Guide)
<div id='NOVCA-Visualization'/>
## NOVCA-Visualization
The python script "paraviewGraph.py" is executed to get the unstructured VTK file "vertex.vtu" which is fed to ParaView to get the graph similar to "graph.png".
<div id='CWRU HPC Specific Guide'/>
## CWRU HPC Specific Guide
Login to HPC & load the git module:
```
module load git
```
Clone the Repository:
```
git clone https://github.com/sxg125/NOVCA-Visualization
```
Go to NOVCA-Visualization directory:
```
cd NOVCA-Visualization
```
Load vtk and python modules:
```
module load vtk
module load python
```
Run the python script:
```
python paraviewGraph.py
```
You will get the "vertex.vtu" file which needs to be fed to the ParaView (https://sites.google.com/a/case.edu/hpc-upgraded-cluster/home/Software-Guide/paraview). Open the file in ParaView, apply glyph and get the one similar to graph "graph.png".
## References
1. [VTK/Python](http://www.vtk.org/Wiki/VTK/Examples/Python/Graphs/NOVCAGraph)
2. [VTK/Cxx](http://www.vtk.org/Wiki/VTK/Examples/Cxx/Graphs/NOVCAGraph)
References:
[1] GitHub Home: github.com
[2] VTK Home: http://www.vtk.org/
[3] GITHUB markdown: https://help.github.com/articles/github-flavored-markdown/