An Algorithm to Discretize One-Dimentional Distributed Port-Hamiltonian Systems