Stellar-mass black holes in young massive and open stellar clusters and their role in gravitational-wave generation